Documents.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/App/Documents", ["exports", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.Site);
  11. global.AppDocuments = mod.exports;
  12. }
  13. })(this, function (_exports, _Site2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.run = run;
  19. _exports.getInstance = getInstance;
  20. _exports.default = _exports.AppDocuments = void 0;
  21. _Site2 = babelHelpers.interopRequireDefault(_Site2);
  22. var AppDocuments =
  23. /*#__PURE__*/
  24. function (_Site) {
  25. babelHelpers.inherits(AppDocuments, _Site);
  26. function AppDocuments() {
  27. babelHelpers.classCallCheck(this, AppDocuments);
  28. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(AppDocuments).apply(this, arguments));
  29. }
  30. babelHelpers.createClass(AppDocuments, [{
  31. key: "initialize",
  32. value: function initialize() {
  33. babelHelpers.get(babelHelpers.getPrototypeOf(AppDocuments.prototype), "initialize", this).call(this);
  34. this.scrollHandle();
  35. this.stickyfillHandle();
  36. }
  37. }, {
  38. key: "process",
  39. value: function process() {
  40. babelHelpers.get(babelHelpers.getPrototypeOf(AppDocuments.prototype), "process", this).call(this);
  41. this.handleResize();
  42. }
  43. }, {
  44. key: "scrollHandle",
  45. value: function scrollHandle() {
  46. $('body').scrollspy({
  47. target: '#articleSticky',
  48. offset: 80
  49. });
  50. }
  51. }, {
  52. key: "stickyfillHandle",
  53. value: function stickyfillHandle() {
  54. if (!window.Stickyfill) {
  55. return false;
  56. }
  57. Stickyfill.add($('#articleSticky')); // $('#articleSticky').Stickyfill();
  58. }
  59. }, {
  60. key: "handleResize",
  61. value: function handleResize() {
  62. $(window).on('resize orientationchange', function () {
  63. $(this).width() > 767 ? Stickyfill.refreshAll() : Stickyfill.removeAll();
  64. }).resize();
  65. }
  66. }]);
  67. return AppDocuments;
  68. }(_Site2.default);
  69. _exports.AppDocuments = AppDocuments;
  70. var instance = null;
  71. function getInstance() {
  72. if (!instance) {
  73. instance = new AppDocuments();
  74. }
  75. return instance;
  76. }
  77. function run() {
  78. var app = getInstance();
  79. app.run();
  80. }
  81. var _default = AppDocuments;
  82. _exports.default = _default;
  83. });