PageSourceSearch

https://hearthis.at/_/v4/scripts/site.js?v=40030

js hearthis.at collected 2026-09-24 08:25:49 UTC 8,920 bytes, 250 lines download raw bytes

1(function ($) {
2	'use strict';
3
4    // btn more
5    $(document).on('click.site', '.btn-more', function(e) {
6      var $dp = $(this).next('.dropdown-menu');
7      if( $dp.html() == "" ){
8        $dp.append('<a class="dropdown-item" href="#"><i aria-hidden="true" class="fa fa-plus fa-fw text-left"></i> Add to Queque</a><a class="dropdown-item" href="#"><i aria-hidden="true" class="fa fa-music fa-fw text-left"></i> Add to Playlist</a><div class="dropdown-divider"></div><a class="dropdown-item" href="#"><i aria-hidden="true" class="far fa-bullhorn fa-fw text-left"></i> Share</a>');
9      }
10
11      if( (e.pageY + $dp.height() + 60) > $('body').height() ){
12        $dp.parent().addClass('dropup');
13      }
14
15      if( e.pageX < $dp.width() ){
16        $dp.removeClass('pull-right');
17      }
18
19    });
20    
21    $(document).on('click.site', '#search-result a', function(e) {
22      $(this).closest('.modal').modal('hide');
23    });
24
25    calcTime();
26
27})(jQuery);
28
29function runAfterAjax() {
30    calcTime();
31}
32
33window.setInterval(function() {
34    //calcTime();
35},10000);
36
37var intLastCalcTimeInit = 0;
38
39function calcTime() {
40
41    intLastInit = Math.round(+new Date()/1000);
42
43    if((Math.round(+new Date()) - intLastCalcTimeInit) > 50) {
44
45        intLastCalcTimeInit = Math.round(+new Date());
46
47        objContainer = jQuery(".calctime");
48
49        objContainer.each(function() {
50            var intItemTime = parseInt(jQuery(this).attr("data-time"), 10);
51
52            if(intItemTime > 0) {
53
54                intItemTime = intItemTime * 1000;
55
56                var seconds = Math.floor((new Date() - intItemTime) / 1000);
57                var interval = Math.floor(seconds / 31536000);
58
59                if (typeof l18nTimeVorSuffixTSingle === "undefined") { var l18nTimeVorSuffixTSingle = " d"; }
60                if (typeof l18nTimeVorSuffixT === "undefined") { var l18nTimeVorSuffixT = " d"; }
61                if (typeof l18nTimeAmPrefix === "undefined") { var l18nTimeAmPrefix = ""; }
62                if (typeof l18nTimeVorSuffixHSingle === "undefined") { var l18nTimeVorSuffixHSingle = " h"; }
63                if (typeof l18nTimeVorSuffixH === "undefined") { var l18nTimeVorSuffixH = " h"; }
64                if (typeof l18nTimeVorSuffixMSingle === "undefined") { var l18nTimeVorSuffixMSingle = " m"; }
65                if (typeof l18nTimeVorSuffixM === "undefined") { var l18nTimeVorSuffixM = " m"; }
66                if (typeof l18nTimeVorNow === "undefined") { var l18nTimeVorNow = "now"; }
67
68                // DAYS
69                interval = Math.floor(seconds / 86400);
70                if ((interval > 0) && (interval < 2	)) {
71                    if(interval == 1) {
72                        var strTimeAgo = interval + l18nTimeVorSuffixTSingle;
73                    } else {
74                        var strTimeAgo = interval + l18nTimeVorSuffixT;
75                    }
76                    jQuery(this).html(strTimeAgo);
77                    return;
78                } else if(interval >= 2){
79                    var date = new Date(intItemTime);
80
81                    var Std = date.getHours();
82                    var StdAusgabe = ((Std < 10) ? "0" + Std : Std);
83                    var Min = date.getMinutes();
84                    var MinAusgabe = ((Min < 10) ? "0" + Min : Min);
85                    var strTimeAgo = l18nTimeAmPrefix + ("0" + date.getDate()).slice(-2) + "." + ("0" + (date.getMonth() + 1)).slice(-2) + "." + (date.getFullYear());
86                    //jQuery(this).html(strTimeAgo);
87
88                    return;
89                }
90
91                // HOURS
92                interval = Math.floor(seconds / 3600);
93                if (interval > 0) {
94                    if(interval == 1) {
95                        var strTimeAgo = interval + l18nTimeVorSuffixHSingle;
96                    } else {
97                        var strTimeAgo = interval + l18nTimeVorSuffixH;
98                    }
99                    jQuery(this).html(strTimeAgo);
100                    return;
101                }
102
103                // MINUTES
104                interval = Math.floor(seconds / 60);
105                if (interval > 0) {
106                    if(interval == 1) {
107                        var strTimeAgo = interval + l18nTimeVorSuffixMSingle;
108                    } else {
109                        var strTimeAgo = interval + l18nTimeVorSuffixM;
110                    }
111                    jQuery(this).html(strTimeAgo);
112                    return;
113                }
114
115                //SECONDS
116                var strTimeAgo = l18nTimeVorNow;
117
118                jQuery(this).html(strTimeAgo);
119                return;
120
121            }
122
123        });
124    }
125}
126
127jQuery(document).ready(function() {
128
129
130    var searchUploads = new Bloodhound({
131        datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value"),
132        queryTokenizer: Bloodhound.tokenizers.whitespace,
133        remote: {
134            url: "/autosuggest.php?q=%QUERY",
135            wildcard: "%QUERY",
136            transform: function(response) {
137                return response || [];
138            }
139        }
140    });
141
142    var searchUsers = new Bloodhound({
143        datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value"),
144        queryTokenizer: Bloodhound.tokenizers.whitespace,
145        remote: {
146            url: "/autosuggest.php?u=%QUERY",
147            wildcard: "%QUERY",
148            transform: function(response) {
149                return response || [];
150            }
151        }
152    });
153
154    $("#search").typeahead({
155            minLength: 0,
156            highlight: true,
157            hint: false
158        },
159        {
160            name: "uploads",
161            display: "value",
162            source: searchUploads,
163            limit: 5,
164            templates: {
165                empty: '',
166                header: '',
167                suggestion: Handlebars.compile('<div class="col-xs-12">' +
168                    '<div class="item r" data-id="item-{{id}}" data-src="{{listen_url}}">' +
169                    '<div class="item-media ">' +
170                    '<a href="{{permalink_url}}" class="item-media-content" style="background-image: url({{image}});"></a>' +
171                    '</div>' +
172                    '<div class="item-info"> <div class="item-title text-ellipsis">' +
173                    '<a href="{{permalink_url}}">{{value}}</a>' +
174                    '</div>' +
175                    '<div class="item-author text-sm text-ellipsis ">' +
176                    '<a href="{{author_url}}" class="text-muted">{{author}}</a>' +
177                    '</div>' +
178                    '<div class="item-meta text-sm text-muted">' +
179                    '</div>' +
180                    '</div>' +
181                    '</div>' +
182                    '</div>')
183            }
184        },
185        {
186            name: "users",
187            display: "value",
188            source: searchUsers,
189            limit: 5,
190            templates: {
191                header: '',
192                empty: '',
193                suggestion: Handlebars.compile('<div class="col-xs-12">' +
194                    '<div class="item">' +
195                    '<div class="item-media rounded ">' +
196                    '<a href="{{permalink_url}}" class="item-media-content" style="background-image: url({{image}});"></a> ' +
197                    '</div> ' +
198                    '<div class="item-info ">
198' +
199                    '<div class="item-title text-ellipsis">' +
200                    '<a href="{{permalink_url}}">{{value}}</a>' +
201                    '<div class="text-sm text-muted">{{tracks_count}} Uploads</div>' +
202                    '</div>' +
203                    '</div>' +
204                    '</div>' +
205                    '</div>'),
206                footer: ''
207
208            }
209        }
210
211    ).on('typeahead:asyncrequest', function(ev) {
212
213    })
214    .on('typeahead:asynccancel typeahead:asyncreceive', function(ev) {
215
216    })
217    .on("typeahead:render", function(ev, suggestion) {
218
219            jQuery("#search-results-tracks").html(jQuery(".tt-dataset-uploads").html());
220            jQuery("#search-results-artists").html(jQuery(".tt-dataset-users").html());
221
222            //jQuery(".tt-dataset-uploads").html("");
223            //jQuery(".tt-dataset-users").html("");
224
225    });
226
227
228
229    var searchVal;
230    $("#search").on("keyup", function() {
231        searchVal = jQuery(this).val();
232    });
233
234    $("#search").on("typeahead:select", function(ev, suggestion) {
235        $("#search").typeahead('val',searchVal).blur();
236        return false;
237
238    });
239/*
240    PullToRefresh.init({
241        mainElement: '#content',
242        distIgnore: 20,
243        onRefresh: function (done) {
244            jQuery.pjax({url: location.pathname, container: '#view'});
245        }
246    });
247 */
248
249});
250

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.