Browse files

switched to using widget extension to handle plugin activation afer a…

…jax movement on widgets screen
  • Loading branch information...
1 parent bc1bbb5 commit 4f534cf30568fbc623cfd500e9d0ef5416c80868 = committed Jan 26, 2012
Showing with 12 additions and 9 deletions.
  1. +11 −1 post-selection-ui.js
  2. +1 −8 post-selection-ui.php
View
12 post-selection-ui.js
@@ -210,7 +210,17 @@
$('.psu-search input[placeholder]').each(setVal).focus(clearVal).blur(setVal);
}
- function __bind(me, fn){ return function(){ return fn.apply(me, arguments) } }
+ function __bind(me, fn){return function(){return fn.apply(me, arguments)}}
$('.psu-box').post_selection_ui();
+
+ //work around for first creation of widget
+ if(typeof(wpWidgets) === 'object') {
+ var oldSave = __bind(wpWidgets, wpWidgets.fixLabels);
+
+ wpWidgets.fixLabels = function(widget) {
+ oldSave(widget);
+ $('.psu-box').post_selection_ui();
+ };
+ }
})(jQuery);
View
9 post-selection-ui.php
@@ -221,14 +221,7 @@ public function render() {
</div>
</div>
- <?php
- if(defined('DOING_AJAX') && DOING_AJAX) {
- ?>
- <script type="text/javascript">
- jQuery('#<?php echo esc_js($this->args['id'] )?>').post_selection_ui();
- </script>
- <?php
- }
+ <?php
return ob_get_clean();
}
}

0 comments on commit 4f534cf

Please sign in to comment.