base.coffee 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. define [
  2. "libraries"
  3. "modules/recursionHelper"
  4. "modules/errorCatcher"
  5. "modules/localStorage"
  6. "utils/underscore"
  7. ], () ->
  8. App = angular.module("SharelatexApp", [
  9. "ui.bootstrap"
  10. "autocomplete"
  11. "RecursionHelper"
  12. "ng-context-menu"
  13. "underscore"
  14. "ngSanitize"
  15. "ipCookie"
  16. "mvdSixpack"
  17. "ErrorCatcher"
  18. "localStorage"
  19. "ngTagsInput"
  20. "ui.select"
  21. ]).config ($qProvider, sixpackProvider, $httpProvider, uiSelectConfig) ->
  22. $qProvider.errorOnUnhandledRejections(false)
  23. uiSelectConfig.spinnerClass = 'fa fa-refresh ui-select-spin'
  24. sixpackProvider.setOptions({
  25. debug: false
  26. baseUrl: window.sharelatex.sixpackDomain
  27. client_id: window.user_id
  28. })
  29. MathJax?.Hub?.Config(
  30. extensions: ["Safe.js"]
  31. messageStyle: "none"
  32. imageFont:null
  33. "HTML-CSS":
  34. availableFonts: ["TeX"]
  35. # MathJax's automatic font scaling does not work well when we render math
  36. # that isn't yet on the page, so we disable it and set a global font
  37. # scale factor
  38. scale: 110
  39. matchFontHeight: false
  40. TeX:
  41. equationNumbers: { autoNumber: "AMS" }
  42. useLabelIDs: false
  43. skipStartupTypeset: true
  44. tex2jax:
  45. processEscapes: true
  46. # Dollar delimiters are added by the mathjax directive
  47. inlineMath: [ ["\\(","\\)"] ]
  48. displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
  49. )
  50. App.run ($templateCache) ->
  51. # UI Select templates are hard-coded and use Glyphicon icons (which we don't import).
  52. # The line below simply overrides the hard-coded template with our own, which is
  53. # basically the same but using Font Awesome icons.
  54. $templateCache.put "bootstrap/match.tpl.html", "<div class=\"ui-select-match\" ng-hide=\"$select.open && $select.searchEnabled\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><span tabindex=\"-1\" class=\"btn btn-default form-control ui-select-toggle\" aria-label=\"{{ $select.baseTitle }} activate\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\" style=\"outline: 0;\"><span ng-show=\"$select.isEmpty()\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"ui-select-match-text pull-left\" ng-class=\"{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}\" ng-transclude=\"\"></span> <i class=\"caret pull-right\" ng-click=\"$select.toggle($event)\"></i> <a ng-show=\"$select.allowClear && !$select.isEmpty() && ($select.disabled !== true)\" aria-label=\"{{ $select.baseTitle }} clear\" style=\"margin-right: 10px\" ng-click=\"$select.clear($event)\" class=\"btn btn-xs btn-link pull-right\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i></a></span></div>"
  55. sl_debugging = window.location?.search?.match(/debug=true/)?
  56. window.sl_console =
  57. log: (args...) -> console.log(args...) if sl_debugging
  58. return App