Scripts n Styles - Version 3.0.3

Version Description

  • Bug Fix: formatting on ajax
Download this release

Release Info

Developer WraithKenny
Plugin Icon wp plugin Scripts n Styles
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

Files changed (3) hide show
  1. README.txt +9 -3
  2. js/meta-box-scripts.js +19 -10
  3. scripts-n-styles.php +5 -5
README.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: WraithKenny, Touvan
3
  Donate link: http://wordpressfoundation.org/donate/
4
  Tags: admin, CSS, javascript, code, custom, Style
5
- Requires at least: 3.2
6
- Tested up to: 3.3-RC2
7
- Stable tag: 3.0.2
8
  License: GPLv2 or later
9
 
10
  This plugin allows Admin users to individually add custom CSS, Classes and JavaScript directly to Post, Pages or any other custom post types.
@@ -53,6 +53,9 @@ Sure, if you are an Admin, just go to the plugin editor and wipe out the uninsta
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 3.0.2 =
57
  * Bug Fix: Fatal Error on post save
58
 
@@ -100,6 +103,9 @@ Sure, if you are an Admin, just go to the plugin editor and wipe out the uninsta
100
 
101
  == Upgrade Notice ==
102
 
 
 
 
103
  = 3.0.2 =
104
  Bug fix
105
 
2
  Contributors: WraithKenny, Touvan
3
  Donate link: http://wordpressfoundation.org/donate/
4
  Tags: admin, CSS, javascript, code, custom, Style
5
+ Requires at least: 3.3
6
+ Tested up to: 3.3
7
+ Stable tag: 3.0.3
8
  License: GPLv2 or later
9
 
10
  This plugin allows Admin users to individually add custom CSS, Classes and JavaScript directly to Post, Pages or any other custom post types.
53
 
54
  == Changelog ==
55
 
56
+ = 3.0.3 =
57
+ * Bug Fix: formatting on ajax
58
+
59
  = 3.0.2 =
60
  * Bug Fix: Fatal Error on post save
61
 
103
 
104
  == Upgrade Notice ==
105
 
106
+ = 3.0.3 =
107
+ Bug Fix: formatting on ajax
108
+
109
  = 3.0.2 =
110
  Bug fix
111
 
js/meta-box-scripts.js CHANGED
@@ -396,14 +396,14 @@ jQuery( document ).ready( function( $ ) {
396
  refreshMCE();
397
  }
398
  function refreshMCE() {
399
- if ( tinyMCE.editors["content"] ) {
 
 
400
  // needed for < 3.3 editor initialization.
401
  if ( ! $( '#content' ).hasClass( '.theEditor' ) ) $( '#content' ).addClass( 'theEditor' );
402
 
403
- if ( tinyMCE.editors["content"].isHidden() ) {
404
- tinyMCE.editors["content"].remove();
405
- tinyMCE.init( initData );
406
- tinyMCE.editors["content"].hide();
407
  } else {
408
  // you've got to be kidding me.
409
  if ( 1 == $('#content-html').length )
@@ -411,18 +411,27 @@ jQuery( document ).ready( function( $ ) {
411
  else if( 1 == $('#edButtonHTML').length )
412
  switchEditors.go('content', 'html'); // 3.2
413
 
414
- tinyMCE.editors["content"].remove();
415
- tinyMCE.init( initData );
416
- tinyMCE.editors["content"].hide();
417
 
418
  if ( 1 == $('#content-tmce').length )
419
  $('#content-tmce').click(); // 3.3
420
  else if( 1 == $('#edButtonPreview').length )
421
  switchEditors.go('content', 'tinymce'); // 3.2
422
  }
423
-
424
  }
 
 
425
  $('.sns-ajax-loading').hide();
426
  }
427
-
 
 
 
 
 
 
 
 
 
428
  });
396
  refreshMCE();
397
  }
398
  function refreshMCE() {
399
+ var ed = tinyMCE.editors["content"];
400
+ // If Visual has been activated.
401
+ if ( ed ) {
402
  // needed for < 3.3 editor initialization.
403
  if ( ! $( '#content' ).hasClass( '.theEditor' ) ) $( '#content' ).addClass( 'theEditor' );
404
 
405
+ if ( ed.isHidden() ) {
406
+ refreshMCEhelper(ed);
 
 
407
  } else {
408
  // you've got to be kidding me.
409
  if ( 1 == $('#content-html').length )
411
  else if( 1 == $('#edButtonHTML').length )
412
  switchEditors.go('content', 'html'); // 3.2
413
 
414
+ refreshMCEhelper(ed);
 
 
415
 
416
  if ( 1 == $('#content-tmce').length )
417
  $('#content-tmce').click(); // 3.3
418
  else if( 1 == $('#edButtonPreview').length )
419
  switchEditors.go('content', 'tinymce'); // 3.2
420
  }
421
+
422
  }
423
+ // Else nothing.
424
+
425
  $('.sns-ajax-loading').hide();
426
  }
427
+ function refreshMCEhelper(ed) {
428
+ ed.save();
429
+ ed.destroy();
430
+ ed.remove();
431
+ if ( initData && initData.wpautop )
432
+ $('#content').val( switchEditors.wpautop( $('#content').val() ) );
433
+ ed = new tinymce.Editor( 'content', initData );
434
+ ed.render();
435
+ ed.hide();
436
+ }
437
  });
scripts-n-styles.php CHANGED
@@ -5,13 +5,13 @@ Plugin URI: http://www.unfocus.com/projects/scripts-n-styles/
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
- Version: 3.0.2
9
  License: GPLv2 or later
10
  Text Domain: scripts-n-styles
11
  Network: true
12
  */
13
 
14
- /* Copyright 2010-2011 Kenneth Newman www.unfocus.com
15
 
16
  This program is free software; you can redistribute it and/or
17
  modify it under the terms of the GNU General Public License
@@ -47,9 +47,9 @@ Network: true
47
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
48
  * @author unFocus Projects
49
  * @link http://www.unfocus.com/ Author URI
50
- * @version 3.0.2
51
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
52
- * @copyright Copyright (c) 2010 - 2011, Kenneth Newman
53
  *
54
  * @todo Add Post Type Selection on Options Page? Not sure that's useful.
55
  * @todo Add Conditional Tags support as alternative to Globally applying Scripts n Styles.
@@ -72,7 +72,7 @@ class Scripts_n_Styles
72
  /**#@+
73
  * @static
74
  */
75
- const VERSION = '3.0.2';
76
  static $file = __FILE__;
77
  /**#@-*/
78
 
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
+ Version: 3.0.3
9
  License: GPLv2 or later
10
  Text Domain: scripts-n-styles
11
  Network: true
12
  */
13
 
14
+ /* Copyright 2010-2012 Kenneth Newman www.unfocus.com
15
 
16
  This program is free software; you can redistribute it and/or
17
  modify it under the terms of the GNU General Public License
47
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
48
  * @author unFocus Projects
49
  * @link http://www.unfocus.com/ Author URI
50
+ * @version 3.0.3
51
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
52
+ * @copyright Copyright (c) 2010 - 2012, Kenneth Newman
53
  *
54
  * @todo Add Post Type Selection on Options Page? Not sure that's useful.
55
  * @todo Add Conditional Tags support as alternative to Globally applying Scripts n Styles.
72
  /**#@+
73
  * @static
74
  */
75
+ const VERSION = '3.0.3';
76
  static $file = __FILE__;
77
  /**#@-*/
78