PageSourceSearch

https://nootheme.com/wp-content/plugins/noo-bbpress-custom-support/assets/js/script.js

js nootheme.com collected 2026-09-24 08:48:21 UTC 11,033 bytes, 279 lines download raw bytes

1/**
2 * Copyright (c) 2007-2013 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
3 * Dual licensed under MIT and GPL.
4 * @author Ariel Flesler
5 * @version 1.4.6
6 */
7;(function ($) {
8    var h = $.scrollTo = function (a, b, c) {
9        $(window).scrollTo(a, b, c)
10    };
11    h.defaults = {axis: 'xy', duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1, limit: true};
12    h.window = function (a) {
13        return $(window)._scrollable()
14    };
15    $.fn._scrollable = function () {
16        return this.map(function () {
17            var a = this, isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;
18            if (!isWin)return a;
19            var b = (a.contentWindow || a).document || a.ownerDocument || a;
20            return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement
21        })
22    };
23    $.fn.scrollTo = function (e, f, g) {
24        if (typeof f == 'object') {
25            g = f;
26            f = 0
27        }
28        if (typeof g == 'function')g = {onAfter: g};
29        if (e == 'max')e = 9e9;
30        g = $.extend({}, h.defaults, g);
31        f = f || g.duration;
32        g.queue = g.queue && g.axis.length > 1;
33        if (g.queue)f /= 2;
34        g.offset = both(g.offset);
35        g.over = both(g.over);
36        return this._scrollable().each(function () {
37            if (e == null)return;
38            var d = this, $elem = $(d), targ = e, toff, attr = {}, win = $elem.is('html,body');
39            switch (typeof targ) {
40                case'number':
41                case'string':
42                    if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
43                        targ = both(targ);
44                        break
45                    }
46                    targ = $(targ, this);
47                    if (!targ.length)return;
48                case'object':
49                    if (targ.is || targ.style)toff = (targ = $(targ)).offset()
50            }
51            $.each(g.axis.split(''), function (i, a) {
52                var b = a == 'x' ? 'Left' : 'Top', pos = b.toLowerCase(), key = 'scroll' + b, old = d[key], max = h.max(d, a);
53                if (toff) {
54                    attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
55                    if (g.margin) {
56                        attr[key] -= parseInt(targ.css('margin' + b)) || 0;
57                        attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0
58                    }
59                    attr[key] += g.offset[pos] || 0;
60                    if (g.over[pos])attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos]
61                } else {
62                    var c = targ[pos];
63                    attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c
64                }
65                if (g.limit && /^\d+$/.test(attr[key]))attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
66                if (!i && g.queue) {
67                    if (old != attr[key])animate(g.onAfterFirst);
68                    delete attr[key]
69                }
70            });
71            animate(g.onAfter);
72            function animate(a) {
73                $elem.animate(attr, f, g.easing, a && function () {
74                        a.call(this, targ, g)
75                    })
76            }
77        }).end()
78    };
79    h.max = function (a, b) {
80        var c = b == 'x' ? 'Width' : 'Height', scroll = 'scroll' + c;
81        if (!$(a).is('html,body'))return a[scroll] - $(a)[c.toLowerCase()]();
82        var d = 'client' + c, html = a.ownerDocument.documentElement, body = a.ownerDocument.body;
83        return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])
84    };
85    function both(a) {
86        return typeof a == 'object' ? a : {top: a, left: a}
87    }
88})(jQuery);
89
90
91jQuery(document).ready(function ($) {
92    $('.noo-doc-ul a').click(function (e) {
93        e.preventDefault();
94        $('.menu-item-has-children').removeClass('active');
95        $(this).closest('.menu-item-has-children').addClass('active');
96        $(this).parent().addClass('active');
97
98        var link = $(this).parent().attr('data-active');
99        var id = link;
100        // $.scrollTo(id, 800);
101
102        $('html, body').animate({
103            scrollTop: $(id).offset().top - 86
104        }, 1000);
105    });
106
107    $("#document-nav-toggle").click(function () {
108        $("#document-nav-menu").animate({
109            height: "toggle",
110            opacity: "toggle"
111        }, 400);
112    });
113
114    var navTop = $('.noo-doc-ul').length ? $('.noo-doc-ul').offset().top : 0,
115        defaultnavHeight = $('.noo-doc-ul').length ? $('.noo-doc-ul').outerHeight() : 0;
116    var docMenuSticky = function () {
117        if (!$('.noo-doc-ul').length) {
118            return;
119        }
120
121        var $this = $(window);
122        var $navbar = $('.noo-doc-ul');
123        var navFixedClass = 'sticky';
124        var adminbarHeight = 0;
125        if ($('body').hasClass('admin-bar')) {
126            adminbarHeight = $('#wpadminbar').outerHeight();
127        }
128        adminbarHeight += $('#header').outerHeight() + 20;
129        var checkingPoint = navTop + defaultnavHeight;
130
131        if (($this.scrollTop() + adminbarHeight) > checkingPoint) {
132            if (!$navbar.hasClass(navFixedClass)) {
133                navHeight = $navbar.hasClass('shrinkable') ? Math.max(Math.round(defaultnavHeight - ($this.scrollTop() + adminbarHeight) + navTop), 60) : defaultnavHeight;
134
135                $navbar.addClass(navFixedClass);
136                $navbar.css('top', 0 - navHeight).animate({'top': adminbarHeight}, 300);
137
138                return;
139            }
140        } else {
141            $navbar.removeClass(navFixedClass);
142        }
143
144        // $navbar.css({'top': ''});
145
146        // $('.navbar-wrapper').css({'min-height': ''});
147        // $navbar.closest('.noo-header').css({'position': ''});
148        // $navbar.css({'min-height': ''});
149        // $navbar.find('.navbar-nav > li > a').css({'line-height': ''});
150    };
151    docMenuSticky();
152    $(window).bind('scroll', docMenuSticky);
153
154    //Go to top
155    $(window).scroll(function () {
156        if ($(this).scrollTop() > 500) {
157            $('.go-to-top').addClass('on');
158        }
159        else {
160            $('.go-to-top').removeClass('on');
161        }
162    });
163    $('body').on('click', '.go-to-top', function () {
164        $("html, body").animate({
165            scrollTop: 0
166        }, 800);
167        return false;
168    });
169
170    if (typeof QTags !== 'undefined') {
171        QTags.addButton('eg_pre', 'pre', '<pre class="brush: php" lang="php">', '</pre>', 'q', 'Preformatted code', 111);
172        QTags.addButton('eg_pre', 'php', '<pre class="brush: php" lang="php">', '</pre>', 'q', 'Preformatted PHP code', 111);
173        QTags.addButton('eg_js', 'js', '<pre class="brush: js" lang="js">', '</pre>', 'q', 'Preformatted JS code', 111);
174        QTags.addButton('eg_css', 'css', '<pre class="brush: css" lang="css">', '</pre>', 'q', 'Preformatted CSS code', 111);
175    }
176});
177
178jQuery(document).ready(function ($) {
179    /*TimeWork*/
180    setInterval(function () {
181        var current_tz = 'current_timezone';
182        var current_time = getdate(current_tz);
183        var our_clock = current_time[1] + ":" + current_time[2] + ":" + current_time[3] + " " + current_time[0];
184        jQuery("#spt_our_time").text(our_clock);
185        jQuery('.spt-out-time').attr('title', 'Our Time: ' + current_time['Month'] + ' ' + current_time['dd'] + ', ' + current_time['YY'] + ' ' + our_clock);
186
187        var timezone = '';
188        var guest_time = getdate(timezone);
189        var your_clock = guest_time[1] + ":" + guest_time[2] + ":" + guest_time[3] + " " + guest_time[0];
190        jQuery("#spt_local_time").text(your_clock);
191        jQuery('.spt-your-time').attr('title', 'Your Time: ' + guest_time['Month'] + ' ' + guest_time['dd'] + ', ' + guest_time['YY'] + ' ' + your_clock);
192    }, 1000);
193    /*Get date*/
194    function getdate(timezone) {
195        var guest_today = new Date();
196
197        var localoffset = -(guest_today.getTimezoneOffset() / 60);
198        var destoffset = parseInt(support_l10n.timezone);
199        var offset = destoffset - localoffset;
200
201        var smart_today = new Date(new Date().getTime() + offset * 3600 * 1000);
202        var today = (timezone == 'current_timezone') ? smart_today : guest_today;
203
204        var ap = '';
205        var h = today.getHours();
206        var m = today.getMinutes();
207        var s = today.getSeconds();
208        var time = [];
209        time[0] = ap = ( h < 12 ) ? 'AM' : 'PM';
210        time[1] = h = ( h <= 12 ) ? h : h - 12;
211        time[1] = h = ( h < 10 ) ? '0' + h : h;
212        time[2] = m = ( m < 10 ) ? '0' + m : m;
213        time[3] = s = ( s < 10 ) ? '0' + s : s;
214        time['dd'] = ( today.getDate() < 10 ) ? '0' + today.getDate() : today.getDate();
215        time['mm'] = ( today.getMonth() + 1 < 10) ? '0' + ( today.getMonth() + 1 ) : today.getMonth() + 1;
216        time['YY'] = today.getFullYear();
217        time['Day'] = today.getDay();
218        var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
218November", "December"];
219        time['Month'] = monthNames[today.getMonth()];
220        return time;
221    };
222});
223
224jQuery(document).ready(function ($) {
225    var noo_get_selection = function () {
226        var t = '';
227
228        if (window.getSelection) {
229            t = window.getSelection();
230        } else if (document.getSelection) {
231            t = document.getSelection();
232        } else if (document.selection) {
233            t = document.selection.createRange().text;
234        }
235
236        return jQuery.trim(t.toString());
237    };
238
239    var noo_post_request = function (path, params, method) {
240        method = method || "post"; // Set method to post by default if not specified.
241
242        // The rest of this code assumes you are not using a library.
243        // It can be made less wordy if you use one.
244        var form = document.createElement("form");
245        form.setAttribute("method", method);
246        form.setAttribute("action", path);
247        form.setAttribute("target", "_blank");
248
249        for (var key in params) {
250            if (params.hasOwnProperty(key)) {
251                var hiddenField = document.createElement("input");
252                hiddenField.setAttribute("type", "hidden");
253                hiddenField.setAttribute("name", key);
254                hiddenField.setAttribute("value", params[key]);
255
256                form.appendChild(hiddenField);
257            }
258        }
259
260        document.body.appendChild(form);
261        form.submit();
262    };
263    $('.noo-user-info-edit-link').click(function (e) {
264        e.stopPropagation();
265        e.preventDefault();
266
267        var _this = $(this);
268        var text = noo_get_selection();
269        if (text === '') {
270            var reply = document.getElementById('d4p-bbp-quote-' + _this.data('id'));
271            text = reply.textContent || reply.innerText;
272        }
273
274        noo_post_request(_this.data('author'), {more_user_info: text});
275
276        return false;
277    });
278});
279

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.