PDA

View Full Version : Solved jquery loading for users unnecessarily



tavenger5
16-10-12, 22:04
The new manual translation feature loads jquery for every user causing my data allocation to go up about 1.75GB a day!

Please add a function to only load jquery for users that have permission to enter manual translations.

I entered this as a bug because it's not really a feature request, but the way things should be.

Marcin Kalak
17-10-12, 19:15
You're right. I thank you for your attention.

tavenger5
18-10-12, 14:22
Please let me know if there is a manual fix for this in the meantime.

Marcin Kalak
18-10-12, 22:00
Quick will fix for the issue is:

Open file includes/vbenterprisetranslator_functions_hooks.php
Find code:


$vbet_scriptInclude ='<script type="text/javascript" src="clientscript/vbet/vbet.script.js"></script><script type="text/javascript" src="clientscript/vbet/jquery.min.js"></script>';
if(isset($template_hook['headinclude_javascript']) ){
$template_hook['headinclude_javascript'] .= $vbet_scriptInclude;
}else{
$template_hook['headinclude_javascript'] = $vbet_scriptInclude;
}

Replace it to code:


require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
global $vbulletin;
if(vbet_canEditCache($vbulletin->userinfo))
{
$vbet_scriptInclude ='<script type="text/javascript" src="clientscript/vbet/vbet.script.js"></script><script type="text/javascript" src="clientscript/vbet/jquery.min.js"></script>';
if(isset($template_hook['headinclude_javascript']) ){
$template_hook['headinclude_javascript'] .= $vbet_scriptInclude;
}else{
$template_hook['headinclude_javascript'] = $vbet_scriptInclude;
}
}


This should fix the issue. We will be add this fix in next release.

tavenger5
18-10-12, 22:55
Thanks! I appreciate it!

Marcin Kalak
19-10-12, 09:33
I'm glad I could help you.

tavenger5
25-10-12, 14:35
actually, this is producing an error:
PHP Fatal error: Call to undefined function vbet_canEditCache() in /home/site/public_html/includes/vbenterprisetranslator_functions_hooks.php on line 685

Marcin Kalak
25-10-12, 15:51
Add just before the edit code:

require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
I add this code to the quick fix.

tavenger5
25-10-12, 16:42
Thanks for the quick response!

Marcin Kalak
25-10-12, 22:29
I'm glad I could help you.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Translations delivered by vB Enterprise Translator 4.10.1