-
Notifications
You must be signed in to change notification settings - Fork 0
/
breezyarchives.js
63 lines (59 loc) · 2.03 KB
/
breezyarchives.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function($){
$(function(){
// Energize Breezy Archives
$("#breezyarchives").addClass("energized");
// Create spinner
$(document.body).append('<div id="breezyarchives-indicator"></div>');
var spinner = {
start: function() {
$("#breezyarchives-indicator").html('<img src="<?php echo Site::get_url( 'admin_theme' ); ?>/images/spin.gif">');
$("#breezyarchives-indicator").show();
},
stop: function() {
$("#breezyarchives-indicator").hide();
}
}
var bapos = $("#breezyarchives").position();
$("#breezyarchives-indicator").css({position:"absolute",top:bapos.top,left:bapos.left+$("#breezyarchives").width()-32})
// Do this when click Next/Previous
function pagination(){
var ul = $(this).parent().parent();
$.ajax({
url: $(this).attr("href"),
beforeSend: function(){
spinner.start();
},
success: function(response){
ul.replaceWith(response);
},
complete: function(){
spinner.stop();
$("#breezyarchives li.pagination a").click(pagination);
}
});
return false;
}
$("#breezyarchives li.type > h3,#breezy-chronology-archive li.year > a,#breezy-chronology-archive li.month > a,#breezy-taxonomy-archive li.tag > a").click(function(){
$(this).parent().siblings().removeClass("selected").find("ul:first").hide();
$(this).parent().addClass("selected").find("ul:first").show();
return false;
});
$("#breezy-chronology-archive li.month > a,#breezy-taxonomy-archive li.tag > a").one("click", function(){
var link = $(this);
$.ajax({
url: link.attr("href").replace("<?php echo $habari_url; ?>", "<?php echo $habari_url . $class_name; ?>/"),
beforeSend: function(){
spinner.start();
},
success: function(response){
link.parent().append(response);
},
complete: function(){
spinner.stop();
$("#breezyarchives li.pagination a").click(pagination);
}
});
});
$("#breezyarchives li.type > h3:first,#breezy-chronology-archive li.year > a:first,#breezy-chronology-archive li.month > a:first").click();
});
})(jQuery);