WordPress.org

Ready to get started?Download WordPress

Forums

File Permissions & Size Check
[resolved] JavaScript error (5 posts)

  1. Clifford Paulick
    Member
    Posted 2 years ago #

    My theme detected a JavaScript error ( http://www.pagelines.com/forum/discussion/6489 ) when this plugin was activated. I verified the error reporting was gone with this inactive and present again when re-activated. Just FYI.

    P.S. Mentioned your plugin here: http://wpmu.org/wordpress-file-permissions/

    Thanks.

    http://wordpress.org/extend/plugins/wp-file-permission-check/

  2. tzdk
    Member
    Posted 1 year ago #

    There are some things wrong with this plugin but easy to fix.

    1. Path to plugin folders is wrong in file-perm-check.php
    2. The version jQuery tools that is called is outdated and loads jQuery main file itself = WP do not like = JS errors
    3. Actually there are more JS errors as the init file file-perm.js is wrong. You just do not see tabs, your screenshot wpmu.org show how tables are one long string.
    4. When you have fixed those errors you see empty screen. Turns out there is a display: none for those tabs. That is why it works out of the box because CSS file is not even loaded due to wrong path.

    Fix 1 and 2:
    I commented out first chunk in file-perm-check.php, then changed next one to use correct file from jQuery tools and to use correct paths.

    //register jquery tools and tab styles
    /*
    add_action('admin_init', 'load_custom_perm_scripts_lcp');
    function load_custom_perm_scripts_lcp() {
    	 wp_register_script('my-jquery-ui', 'http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js');
    	 wp_register_script('my-perm-js', WP_PLUGIN_URL . '/file-permission-check/file-perm.js');
    	 wp_register_style('jquery-style', WP_PLUGIN_URL . '/file-permission-check/file-perm-check.css');
             }
    */
    
    //load stuff only on plugin page
    //add_action( 'admin_print_styles',  'load_admin_perm_styles' );
    add_action( 'admin_init',  'load_admin_perm_styles_lap' );
    function load_admin_perm_styles_lap(){
    	if( (is_admin() ) && (isset($_GET['page']) == "perm_check") ) {
    		wp_enqueue_style('jquery-style', WP_PLUGIN_URL . '/wp-file-permission-check/file-perm-check.css'); // path to plugin is not file-permission-check
    		wp_enqueue_script('my-jquery-ui', 'http://cdn.jquerytools.org/1.2.7/tiny/jquery.tools.min.js', array('jquery')); // Does not load jQuery, only tabs
    		wp_enqueue_script('my-perm-js', WP_PLUGIN_URL . '/wp-file-permission-check/file-perm.js'); // path to plugin is not file-permission-check
    	}
    }

    Fix 3:
    Change content of file-perm.js to this

    (function($) {
    	   $('ul.tabs').tabs('div.panes > div');
               });
    (jQuery);

    Fix 4:
    Comment out or delete in file-perm-check-css

    /* tab pane */
    .panes div{
    /*	display:none; */
    	border:1px solid #666;
    	border-width:0 1px 1px 1px;
    	min-height:150px;
    /*	padding:15px 20px; */
    	background-color:#ddd;
    }

    And plugin seem to be fully working.

    Edit: actually it is not because there are still some tab issues. You can look up correct syntax at jquery tools site, http://jquerytools.org/demos/tabs/index.html then fix in plugin. Not so sure it is a CSS issue. Could be a HTML bug.

    Neat little plugin so would be cool if dev. did real fixes.

  3. tzdk
    Member
    Posted 1 year ago #

    I got the briliant idea to NOT check on a superfat install and found something interesting. Tabs DO work with this in file-perm.js

    jQuery(document).ready(function () {
    	   jQuery("ul.tabs").tabs("div.panes > div");
    });

    They do NOT work with what I posted before. Not for me... They look as if they work but they are dead. JS never kicks in.

    Back to fat install with new tab init code but nope, they freaking still do not work. Tried forcing file-perm.js in footer, same result. There are no erors so I have no clue. Conflict I asssume.

    So try a bit of both :) May be dev. should use jQuery UI instead if he/she can reproduce the working/not working states. Could very well be a conflict on my end though.

    Aaand it was. CSS from Post Snippets http://wordpress.org/extend/plugins/post-snippets/ kill the fun. A little too generic naming scheme for a file that apparently must be loaded on all pages! - or is it that this plugin believe there is no reason to be specific, it is not, as it only loads on 1 page! Dont know :)

  4. wycks
    Member
    Plugin Author

    Posted 1 year ago #

    The name "tabs" is hardcoded in jquery.ui AND jquery.tools. I did not know these before and would have never chosen jquery.tools, so the plugin has to be rewritten to just use jquery.ui.

  5. wycks
    Member
    Plugin Author

    Posted 1 year ago #

    Plugin has been re-written from scratch please report any new issues in a new thread or via github: https://github.com/wycks/WP-File-Permission-Check

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.