Permalink
Browse files

Firefox javascript & other bugs #25

  • Loading branch information...
1 parent d242079 commit 69802e5397f7cb481497bfdb1b7886d2cdef48d1 @sewpafly committed Sep 7, 2011
Showing with 35 additions and 11 deletions.
  1. +6 −0 README.txt
  2. +5 −2 js/pte.coffee
  3. +5 −3 js/pte.full.js
  4. +17 −4 php/functions.php
  5. +2 −2 post-thumbnail-editor.php
View
@@ -63,6 +63,9 @@ Using a version with [json_encode](http://www.php.net/manual/en/function.json-en
== Changelog ==
+= 1.0.3 =
+* Fixed some javascript issues
+
= 1.0.2 =
* Problem with SVN commit of 1.0.1
@@ -88,6 +91,9 @@ Using a version with [json_encode](http://www.php.net/manual/en/function.json-en
== Upgrade Notice ==
+= 1.0.3 =
+Fixed javascript problems
+
= 1.0.2 =
Problem with SVN commit of 1.0.1
View
@@ -75,14 +75,16 @@ $.fn.extend
if (not isVisible)
$elem.show 0, ->
$(this).animate {'left': move_to}, options.speed, options.easing, next
+ true
else
$elem.animate {'left': move_to}, options.speed, options.easing
$elem.hide 0, next
true
- if (options.callback)
+ true
+ if options.callback?
pte_queue.queue (next) ->
if options.callbackargs?
- options.callback.apply this, options.callbackargs
+ options.callback.apply this, options.callbackargs
else
options.callback.apply this
next()
@@ -243,6 +245,7 @@ do (pte) ->
zIndex: 1200
instance: true
onSelectEnd: (img, s) ->
+ # Check that getSelection returns valid information...
if s.width && s.width > 0 and s.height && s.height > 0 and $('.pte-size').filter(':checked').size() > 0
$('#pte-submit').removeAttr('disabled')
else
View
@@ -767,17 +767,18 @@
};
options = $.extend(defaults, options);
this.each(function() {
- return pte_queue.queue(__bind(function(next) {
+ pte_queue.queue(__bind(function(next) {
var $elem, direction, isVisible, move_to;
$elem = $(this);
direction = options.direction === 'left' ? -1 : 1;
move_to = $elem.css('left') === "0px" ? $(window).width() * direction : 0;
isVisible = $elem.is(':visible');
if (!isVisible) {
$elem.show(0, function() {
- return $(this).animate({
+ $(this).animate({
'left': move_to
}, options.speed, options.easing, next);
+ return true;
});
} else {
$elem.animate({
@@ -787,8 +788,9 @@
}
return true;
}, this));
+ return true;
});
- if (options.callback) {
+ if (options.callback != null) {
pte_queue.queue(function(next) {
if (options.callbackargs != null) {
options.callback.apply(this, options.callbackargs);
View
@@ -167,7 +167,7 @@ function pte_get_image_data( $id, $size, $size_data ){
$size_data['crop']
);
if ($resized){
- $metadata = wp_get_attachment_metadata($id);
+ $metadata = wp_get_attachment_metadata($id, true);
$metadata['sizes'][$size] = $resized;
wp_update_attachment_metadata( $id, $metadata);
}
@@ -267,12 +267,25 @@ function pte_launch(){
// Get the information needed for image preview
// (See wp-admin/includes/image-edit.php)
$nonce = wp_create_nonce("image_editor-$id");
- $meta = wp_get_attachment_metadata($id);
+ $meta = wp_get_attachment_metadata($id, true);
- if ( is_array($meta) && isset($meta['width']) )
+ if ( is_array($meta) && isset( $meta['width'] ) ){
$big = max( $meta['width'], $meta['height'] );
+ }
+ else {
+ $logger->error(
+ sprintf( __( "Invalid meta data for POST #%d: %s" )
+ , $id
+ , print_r( $meta, true )
+ )
+ );
+ $logger->error( __( "Please contact support", PTE_DOMAIN ) );
+ }
$sizer = $big > 400 ? 400 / $big : 1;
+ $logger->debug( "USER-AGENT: " . $_SERVER['HTTP_USER_AGENT'] );
+ $logger->debug( "WORDPRESS: " . $GLOBALS['wp_version'] );
+ $logger->debug( "SIZER: ${sizer}" );
require( PTE_PLUGINPATH . "html/pte.php" );
}
@@ -585,7 +598,7 @@ function pte_confirm_images(){
list( $w, $h, $type ) = $image_dimensions;
//print("IMAGE DIMENSIONS...");
//print_r( $image_dimensions );
- $metadata = wp_get_attachment_metadata( $id );
+ $metadata = wp_get_attachment_metadata( $id, true );
$metadata['sizes'][$size] = array(
'file' => basename( $new_file ),
'width' => $w,
@@ -3,7 +3,7 @@
Plugin URI: http://wordpress.org/extend/plugins/post-thumbnail-editor/
Author: sewpafly
Author URI: http://sewpafly.github.com/post-thumbnail-editor
- Version: 1.0.2
+ Version: 1.0.3-beta
Description: Individually manage your post thumbnails
LICENSE
@@ -35,7 +35,7 @@
define( 'PTE_PLUGINURL', plugins_url(basename( dirname(__FILE__))) . "/");
define( 'PTE_PLUGINPATH', dirname(__FILE__) . "/");
define( 'PTE_DOMAIN', "post-thumbnail-editor");
-define( 'PTE_VERSION', "1.0.2");
+define( 'PTE_VERSION', "1.0.3-beta");
/*
* Option Functionality

0 comments on commit 69802e5

Please sign in to comment.