Changeset 373
- Timestamp:
- 01/30/2010 01:52:55 AM (2 years ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 2 edited
-
js/transposh.js (modified) (1 diff)
-
transposh.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/transposh.js
r372 r373 17 17 // source - 0 is human, 1 is google translate - 2 is msn translate , and higher reserved for future engines 18 18 /*global Date, Math, Microsoft, alert, clearTimeout, document, google, jQuery, setTimeout, t_jp, window */ 19 // fetch translation from google translate...20 // We first try to avoid conflict with other frameworks21 jQuery.noConflict();22 23 19 (function ($) { // closure 24 20 var langLoaded, loadLang, getMSN, -
trunk/WordPress/plugin/transposh/transposh.php
r370 r373 116 116 add_action('wp_print_styles', array(&$this,'add_transposh_css')); 117 117 add_action('wp_print_scripts', array(&$this,'add_transposh_js')); 118 add_action('wp_head', array(&$this,'add_transposh_async'));118 // add_action('wp_head', array(&$this,'add_transposh_async')); 119 119 add_action("sm_addurl",array(&$this,'add_sm_transposh_urls')); 120 120 register_activation_hook(__FILE__, array(&$this,'plugin_activate')); … … 461 461 function add_transposh_css() { 462 462 //translation not allowed - no need for the transposh.css 463 if(!$this->is_editing_permitted() && !$this->is_auto_translate_permitted()) return; 463 if(!$this->is_editing_permitted() && !$this->is_auto_translate_permitted()) return; 464 464 // actually - this is only needed when editing 465 465 if (!$this->edit_mode) return; … … 484 484 if($this->edit_mode || $this->is_auto_translate_permitted()) { 485 485 //TODO - fix (onetime var) 486 wp_deregister_script('jquery'); 487 wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2'); 486 // wp_deregister_script('jquery'); 487 //wp_enqueue_script("jquery"); 488 //wp_enqueue_script("transposh","{$this->transposh_plugin_url}/js/transposh.js",array("jquery"),TRANSPOSH_PLUGIN_VER,true) 489 wp_enqueue_script("transposh","{$this->transposh_plugin_url}/js/transposh.js",array("jquery"),TRANSPOSH_PLUGIN_VER); 490 // true -> 1, false -> nothing 491 wp_localize_script("transposh","t_jp",array( 492 'url' => $this->post_url, 493 'plugin_url' => $this->transposh_plugin_url, 494 'edit' => ($this->edit_mode? '1' : ''), 495 //'rtl' => (in_array ($this->target_language, $GLOBALS['rtl_languages'])? 'true' : ''), 496 'lang' => $this->target_language, 497 // those two options show if the script can support said engines 498 'msn' => (in_array($this->target_language,$GLOBALS['bing_languages']) && $this->options->get_msn_key() ? '1' : ''), 499 'google' => (in_array($this->target_language,$GLOBALS['google_languages']) ? '1' : ''), 500 'prefix' => SPAN_PREFIX, 501 'msnkey'=>$this->options->get_msn_key(), 502 'preferred'=> $this->options->get_preferred_translator(), 503 'progress'=>$this->edit_mode || $this->options->get_widget_progressbar() ? '1' : '') 504 // 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 505 ); 506 /*wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');*/ 488 507 // toying around - for later... 489 508 // wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js",array(),'1.4.1'); … … 495 514 * @return nothing 496 515 */ 497 function add_transposh_async() { 516 // lost in compatability 517 /* function add_transposh_async() { 498 518 if (!$this->edit_mode && !$this->is_auto_translate_permitted()) { 499 519 return; … … 515 535 echo "t_jp.progress=".($this->edit_mode || $this->options->get_widget_progressbar() ? 'true' : 'false').";"; 516 536 517 /*518 * // let's lazy load! (worked, didn't make sense)519 // jQuery(document).ready(520 jQuery(window).load(521 function() {522 jQuery.ajax({523 type: 'GET',524 url: '{$this->transposh_plugin_url}/js/transposh.js?ver=".TRANSPOSH_PLUGIN_VER."',525 dataType: 'script',526 cache: true527 });528 });529 */530 537 echo "var tp = document.createElement('script'); tp.type = 'text/javascript'; tp.async = true;"; 531 538 echo "tp.src = '{$this->transposh_plugin_url}/js/transposh.js?ver=".TRANSPOSH_PLUGIN_VER."';"; 532 539 echo "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(tp);"; 533 540 echo"</script>"; 534 } 541 }*/ 535 542 536 543 /**
Note: See TracChangeset
for help on using the changeset viewer.
