common.js 931 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * GitPHP Javascript common loader
  3. *
  4. * Initializes script modules used across all pages
  5. *
  6. * @author Christopher Han <xiphux@gmail.com>
  7. * @copyright Copyright (c) 2011 Christopher Han
  8. * @package GitPHP
  9. * @subpackage Javascript
  10. */
  11. define(["jquery", "module", "modules/getproject", "modules/lang", "modules/tooltip.snapshot", "modules/tooltip.commit", "modules/tooltip.tag", 'modules/loginpopup', 'modernizr'],
  12. function($, module, project, lang, tooltipSnapshot, tooltipCommit, tooltipTag, loginpopup) {
  13. $(function() {
  14. lang($('div.lang_select'));
  15. tooltipSnapshot($('a.snapshotTip'));
  16. if (project) {
  17. tooltipCommit($('a.commitTip'));
  18. tooltipTag($('a.tagTip'));
  19. }
  20. if (!Modernizr.input.autofocus) {
  21. $('input[autofocus]').filter(':first').focus();
  22. }
  23. loginpopup('a.loginLink');
  24. });
  25. if (module.config().debug) {
  26. require(['modules/debug']);
  27. }
  28. }
  29. );