PageSourceSearch

https://qashstat.uz/plugins/dropfilesthemes/default/js/script.js

js qashstat.uz collected 2026-10-02 23:23:42 UTC 10,777 bytes, 230 lines download raw bytes

1/**
2 * Dropfiles
3 *
4 * We developed this code with our hearts and passion.
5 * We hope you found it useful, easy to understand and to customize.
6 * Otherwise, please feel free to contact us at [email protected] *
7 * @package Dropfiles
8 * @copyright Copyright (C) 2013 JoomUnited (http://www.joomunited.com). All rights reserved.
9 * @copyright Copyright (C) 2013 Damien Barrère (http://www.crac-design.com). All rights reserved.
10 * @license GNU General Public License version 2 or later; http://www.gnu.org/licenses/gpl-2.0.html
11 */
12
13jQuery(document).ready(function ($) {
14    var sourcefiles = $("#dropfiles-template-default-files").html();
15    var sourcecategories = $("#dropfiles-template-default-categories").html();
16    var default_hash = window.location.hash;
17    var tree = $('.dropfiles-foldertree-default');
18    var tree_source_cat = $('.dropfiles-content-default.dropfiles-content-multi').data('category');
19    var cParents = {};
20
21    if (typeof sourcefiles != 'undefined' && sourcefiles != null) {
22        var reg = new RegExp(dropfilesRootUrl + "{{", 'g');
23        sourcefiles = sourcefiles.replace(reg, "{{");
24    }
25
26    $(".dropfiles-content-default").each(function (index) {
27        var topCat = $(this).data('category');
28        cParents[topCat] = {parent_id: 0, id: topCat, title: $(this).find("h2").text()};
29        $(this).find(".dropfilescategory.catlink").each(function (index) {
30            var tempidCat = $(this).data('idcat');
31            cParents[tempidCat] = {parent_id: topCat, id: tempidCat, title: $(this).text()};
32        })
33    });
34
35    Handlebars.registerHelper('bytesToSize', function (bytes) {
36        return bytesToSize(bytes);
37    });
38
39    Handlebars.registerHelper('isGGExt', function (ext, options) {
40        if (dropfilesGVExt.indexOf(ext) >= 0) {
41            return options.fn(this);
42        }
43    });
44
45    Handlebars.registerHelper('encodeURI', function (uri) {
46        res = encodeURIComponent(uri);
47        return res;
48    });
49
50    function default_initClick() {
51        $('.dropfiles-content-default.dropfiles-content-multi .catlink').click(function (e) {
52            e.preventDefault();
53            default_load($(this).parents('.dropfiles-content-default.dropfiles-content-multi').data('category'), $(this).data('idcat'), null);
54        });
55    }
56
57    default_initClick();
58    initManageFile($('.dropfiles-content-default.dropfiles-content-multi .catlink').parents('.dropfiles-content-default.dropfiles-content-multi').data('category'));
59    default_hash = default_hash.replace('#', '');
60    if (default_hash != '') {
61        var hasha = default_hash.split('-');
62        var re = new RegExp("^(p[0-9]+)$");
63        var page = null;
64        var stringpage = hasha.pop();
65
66        if (re.test(stringpage)) {
67            page = stringpage.replace('p', '');
68        }
69
70        var hash_category_id = hasha[0];
71        if (!parseInt(hash_category_id)) {
72            return;
73        }
74        setTimeout(function () {
75            default_load($('.dropfiles-content-default.dropfiles-content-multi').data('category'), hash_category_id, null);
76        }, 100)
77    }
78
79    function default_load(sourcecat, category, page) {
80        var pathname = window.location.pathname;
81        var container = $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]");
82        $(document).trigger('dropfiles:category-loading');
83        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]").find('#current_category').val(category);
84        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-container-default").empty();
85        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-container-default").html($('#dropfiles-loading-wrap').html());
86
87        //Get categories
88        $.ajax({
89            url: dropfilesBaseUrl + "index.php?option=com_dropfiles&view=frontcategories&format=json&id=" + category + "&top=" + sourcecat,
90            dataType: "json"
91        }).done(function (categories) {
92            if (page != null) {
93                window.history.pushState('', document.title, pathname + '#' + category + '-' + categories.category.alias + '-p' + page);
94            } else {
95                window.history.pushState('', document.title, pathname + '#' + category + '-' + categories.category.alias);
96            }
97            $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]").find('#current_category_slug').val(categories.category.alias);
98
99            var template = Handlebars.compile(sourcecategories);
100            var html = template(categories);
101
102            $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-container-default").prepend(html);
103
104            for (i = 0; i < categories.categories.length; i++) {
105                cParents[categories.categories[i].id] = categories.categories[i];
106            }
107
108            default_breadcrum(sourcecat, category);
109            default_initClick();
110            initManageFile(sourcecat);
111            if (tree.length) {
112                var currentTree = container.find('.dropfiles-foldertree-default');
113                currentTree.find('li').removeClass('selected');
114                currentTree.find('i.zmdi').removeClass('zmdi-folder').addClass("zmdi-folder");
115
116                currentTree.jaofoldertree('open', category, currentTree);
117
118                var el = currentTree.find('a[data-file="' + category + '"]').parent();
119                el.find(' > i.zmdi').removeClass("zmdi-folder").addClass("zmdi-folder");
120
121                if (!el.hasClass('selected')) {
122                    el.addClass('selected');
123                }
124
125            }
126        });
127
128        //Get files
129        $.ajax({
130            url: dropfilesBaseUrl + "index.php?option=com_dropfiles&view=frontfiles&format=json&id=" + category,
131            dataType: "json"
132        }).done(function (content) {
133            var template = Handlebars.compile(sourcefiles);
134            var html = template(content);
135            $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-container-default").append(html);
136            if (typeof(dropfilesColorboxInit) !== 'undefined') {
137                dropfilesColorboxInit();
138            }
139            dropfiles_remove_loading($(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-container-default"));
140        });
141        $(document).trigger('dropfiles:category-loaded');
142    }
143
144    function default_breadcrum(sourcecat, catid) {
145
146        var links = [];
147        current_Cat = cParents[catid];
148
149        if (typeof (current_Cat) == 'undefined') {
150            // todo: made breadcrumb working when reload page with hash
151            return;
152        }
153        links.unshift(current_Cat);
154
155        if (typeof(current_Cat.parent_id) != 'undefined') {
156            while (cParents[current_Cat.parent_id]) {
157                current_Cat = cParents[current_Cat.parent_id];
158                links.unshift(current_Cat);
159            }
160            ;
161        }
162
163        html = '';
164        for (i = 0; i < links.length; i++) {
165            if (i < links.length - 1) {
166                html += '<li><a class="catlink" data-idcat="' + links[i].id + '" href="javascript:void(0)">' + links[i].title + '</a><span class="divider"> &gt; </span></li>';
167            } else {
168                html += '<li><span>' + links[i].title + '</span></li>';
169            }
170        }
171        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-breadcrumbs-default li").remove();
172        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "] .dropfiles-breadcrumbs-default").append(html);
173
174    }
175
176    if (tree.length) {
177        tree.each(function () {
178            var topCat = $(this).parents('.dropfiles-content-default.dropfiles-content-multi').data('category');
179            var rootCatName = $(this).parents('.dropfiles-content-default.dropfiles-content-multi').data('category-name');
180
181            $(this).jaofoldertree({
182                script: dropfilesBaseUrl + 'index.php?option=com_dropfiles&task=frontfile.getSubs&tmpl=component',
183                usecheckboxes: false,
184                root: topCat,
185                showroot: rootCatName,
186                onclick: function (elem, file) {
187                    topCat = $(elem).parents('.dropfiles-content-default.dropfiles-content-multi').data('category');
188                    if (topCat != file) {
189
190                        $('.directory', $(elem).parents('.dropfiles-content-default.dropfiles-content-multi')).each(function() {
191                            if (!$(this).hasClass('selected') && $(this).find('> ul > li').length === 0) {
192                                $(this).removeClass('expanded');
193                                $(this).addClass('collapsed');
194                            }
195                        });
196
197                        $(elem).parents('.directory').each(function () {
198                            var $this = $(this);
199                            var category = $this.find(' > a');
200                            var parent = $this.find('.icon-open-close');
201                            if (parent.length > 0) {
202                                if (typeof cParents[category.data('file')] == 'undefined') {
203                                    cParents[category.data('file')] = {
204                                        parent_id: parent.data('parent_id'),
205                                        id: category.data('file'),
206                                        title: category.text()
207                                    };
208                                }
209                            }
210                        });
211
212                    }
213
214                    default_load(topCat, file, null);
215                }
216            });
217        });
218
219    }
220
221    function initManageFile(sourcecat) {
222        if (typeof sourcecat == 'undefined') {
223            sourcecat = $('.dropfiles-content-default.dropfiles-content-multi').data('category');
224        }
225        var current_category = $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]").find('#current_category').val();
226        var link_manager = $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]").find('.openlink-manage-files').data('urlmanage');
227        link_manager = link_manager + '&task=site_manage&site_catid=' + current_category + '&tmpl=dropfilesfrontend';
228        $(".dropfiles-content-default.dropfiles-content-multi[data-category=" + sourcecat + "]").find('.openlink-manage-files').attr('href', link_manager);
229    }
230});

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.