Ticket #68 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

translation ui css is loading unnecessarily

Reported by: datapharmer Owned by: ofer
Priority: minor Milestone: 0.5 - Beta wordpress plugin
Component: WordPress Plugin Version: 0.3.7
Keywords: translation, translator, efficiency, css, jquery, google Cc:

Description

If a non-translator views a page transposh.php loads the translation UI css even though it serves no purpose. Modifying the add_transposh_css function should correct this condition which will save ~22kB of bandwidth for affected users.

An example that should prevent the jquery-ui from loading is as follows:

{{{
    function add_transposh_css() {
        if(!$this->is_editing_permitted() && !$this->is_auto_translate_permitted()) {
            //translation not allowed - no need for the transposh.css
            return;
        }

        //include the transposh.css
        wp_enqueue_style("transposh","{$this->transposh_plugin_url}/css/transposh.css",array(),TRANSPOSH_PLUGIN_VER);

	//Only load translation ui if user is a translator
	if(current_user_can(TRANSLATOR)) {
		   wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",array(),'1.0');
        }

    }
}}}

Change History

comment:1 Changed 2 years ago by ofer

  • Status changed from new to closed
  • Resolution set to fixed

You have a point there, but my guess that this line should only be removed in the case that the progressbar is disabled and editing is not permitted. Added such a line to code, will commit later

comment:2 Changed 2 years ago by ofer

fixed in [313]

Note: See TracTickets for help on using tickets.