polyglot.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. function BxDevPolyglot(oOptions) {
  2. this._sActionsUrl = oOptions.sActionUrl;
  3. this._sPolyglotUrl = oOptions.sPolyglotUrl;
  4. this._sObjName = oOptions.sObjName == undefined ? 'oBxDevPolyglot' : oOptions.sObjName;
  5. this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
  6. this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  7. }
  8. BxDevPolyglot.prototype.recompile = function(sLanguage) {
  9. this.perform('recompile', sLanguage);
  10. };
  11. BxDevPolyglot.prototype.restore = function(sLanguage, sModule) {
  12. this.perform('restore', sLanguage, sModule);
  13. };
  14. BxDevPolyglot.prototype.perform = function(sAction, sLanguage, sModule) {
  15. var $this = this;
  16. var oDate = new Date();
  17. var oParams = {
  18. pgt_action: sAction,
  19. _t:oDate.getTime()
  20. };
  21. if(sLanguage)
  22. oParams['pgt_language'] = sLanguage;
  23. if(sModule)
  24. oParams['pgt_module'] = sModule;
  25. bx_loading($('body'), true);
  26. $.post(
  27. this._sPolyglotUrl,
  28. oParams,
  29. function(oData) {
  30. bx_loading($('body'), false);
  31. if(oData.content)
  32. bx_alert(oData.content);
  33. },
  34. 'json'
  35. );
  36. };