PageSourceSearch

https://nazarenespace.com/assets/6dc3cfc8/js/humhub.activity.js?v=1723430289

js nazarenespace.com collected 2026-10-02 13:08:55 UTC 3,857 bytes, 136 lines download raw bytes

1/**
2 * Core module for managing Streams and StreamItems
3 * @type Function
4 */
5humhub.module('activity', function (module, require, $) {
6
7    var util = require('util');
8    var stream = require('stream');
9    var Widget = require('ui.widget').Widget;
10    var container = require('content.container');
11    var user = require('user');
12    var view = require('ui.view');
13
14    /**
15     * Number of initial stream enteis loaded when stream is initialized.
16     * @type Number
17     */
18    var STREAM_INIT_COUNT = 10;
19
20    /**
21     * Number of stream entries loaded with each request (except initial request)
22     * @type Number
23     */
24    var STREAM_LOAD_COUNT = 10;
25
26    /**
27     * Number of stream entries loaded with each request (except initial request)
28     * @type string
29     */
30    var ACTIVITY_STREAM_SELECTOR = '#activityStream';
31
32    /**
33     * ActivityStream instance;
34     * @type ActivityStream
35     */
36    var instance;
37
38
39    var ActivityStreamEntry = stream.StreamEntry.extend();
40
41    ActivityStreamEntry.prototype.delete = function () {/* Not implemented */
42    };
43    ActivityStreamEntry.prototype.edit = function () {/* Not implemented */
44    };
45
46    /**
47     * ActivityStream implementation.
48     *
49     * @param {type} container id or jQuery object of the stream container
50     * @returns {undefined}
51     */
52    var ActivityStream = stream.Stream.extend(function (container, options) {
53        stream.Stream.call(this, container, {
54            scrollSupport: true,
55            scrollOptions: {rootMargin: "30px"},
56            initLoadCount: STREAM_INIT_COUNT,
57            loadCount: STREAM_LOAD_COUNT,
58            autoUpdate: true,
59            streamEntryClass: ActivityStreamEntry,
60        });
61    });
62
63    ActivityStream.prototype.initEvents = function (events) {
64        var that = this;
65        this.on('humhub:stream:afterAddEntries', function () {
66            if (view.isLarge() && !that.$content.getNiceScroll().length) {
67                that.$content.niceScroll({
68                    cursorwidth: "7",
69                    cursorborder: "",
70                    cursorcolor: "#555",
71                    cursoropacitymax: "0.2",
72                    nativeparentscrolling: false,
73                    railpadding: {top: 0, right: 3, left: 0, bottom: 0}
74                });
75            } else {
76                that.$content.getNiceScroll().resize();
77            }
78        });
79    };
80
81    ActivityStream.prototype.isUpdateAvailable = function (events) {
82        var that = this;
83
84        var updatesAvailable = false;
85        events.forEach(function (event) {
86            if (that.entry(event.data.contentId)) {
87                return;
88            }
89
90            if (event.data.streamChannel !== 'activity') {
91                return;
92            }
93
94            if (event.data.originator === user.guid()) {
95                return;
96            }
97
98            if (container.guid() === event.data.sguid || container.guid() === event.data.uguid) {
99                updatesAvailable = true;
100            }
101        });
102
103        return updatesAvailable;
104    };
105
106    ActivityStream.templates = {
107        streamMessage: '<div class="streamMessage activity"><div class="panel-body">{message}</div></div>'
108    };
109
110    var getStream = function () {
111        instance = instance || Widget.instance(ACTIVITY_STREAM_SELECTOR);
112
113        if (!instance.$.length) {
114            return;
115        }
116
117        return instance;
118    };
119
120
121    var unload = function () {
122        // Cleanup nicescroll rails from dom
123        if (instance && instance.$) {
124            instance.$content.getNiceScroll().remove();
125            instance.$content.css('overflow', 'hidden');
126        }
127        instance = undefined;
128    };
129
130    module.export({
131        ActivityStream: ActivityStream,
132        getStream: getStream,
133        initOnPjaxLoad: true,
134        unload: unload
135    });
136});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.