Le repo des sources pour le site web des JM2L
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
2.2 KiB

  1. // Avoid `console` errors in browsers that lack a console.
  2. (function() {
  3. var method;
  4. var noop = function () {};
  5. var methods = [
  6. 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
  7. 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
  8. 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
  9. 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
  10. ];
  11. var length = methods.length;
  12. var console = (window.console = window.console || {});
  13. while (length--) {
  14. method = methods[length];
  15. // Only stub undefined methods.
  16. if (!console[method]) {
  17. console[method] = noop;
  18. }
  19. }
  20. }());
  21. // Place any jQuery/helper plugins in here.
  22. function HandleControls() {
  23. // Trig some javascript to handle New Dialog content
  24. $.each( $('.fileupload'),
  25. function( NumCtrl, Ctrl ) {
  26. $("#"+Ctrl.id).fileupload({
  27. // Uncomment the following to send cross-domain cookies:
  28. //xhrFields: {withCredentials: true},
  29. //url: '/uploader/proceed/'
  30. url: this.action
  31. });
  32. // Enable iframe cross-domain access via redirect option:
  33. $("#"+Ctrl.id).fileupload(
  34. 'option',
  35. 'redirect',
  36. window.location.href.replace(
  37. /\/[^\/]*$/,
  38. '/cors/result.html?%s'
  39. )
  40. );
  41. $("#"+Ctrl.id).addClass('fileupload-processing');
  42. $.ajax({
  43. // Uncomment the following to send cross-domain cookies:
  44. //xhrFields: {withCredentials: true},
  45. //url: this.action,
  46. url: $("#"+Ctrl.id).fileupload('option', 'url'),
  47. //url: "uploader/proceed/",
  48. dataType: 'json',
  49. context: $("#"+Ctrl.id)[0]
  50. }).always(function () {
  51. $(this).removeClass('fileupload-processing');
  52. }).done(function (result) {
  53. $(this).fileupload('option', 'done')
  54. .call(this, $.Event('done'), {result: result}); //$(this)});
  55. });
  56. }
  57. );
  58. }