PageSourceSearch

https://opendevelopmentmyanmar.net/wp-content/themes/wp-odm_theme/inc/jeo-scripts/sticky-posts.js?ver=0.1.2

js opendevelopmentmyanmar.net collected 2026-10-02 18:33:40 UTC 4,159 bytes, 150 lines download raw bytes

1(function($) {
2	jeo.markersReady(function(map) {
3
4		var t;
5        //var tab_sticky_posts_active  = ".sticky-posts-active " ;
6        var tab_sticky_posts_active  = "" ;
7		function openSticky(postid) {
8
9			var item = $(tab_sticky_posts_active + '.sticky-item[data-postid="' + postid + '"]');
10
11			map.markers.focusMarker('post-' + postid);
12
13			$(tab_sticky_posts_active + '.sticky-item').removeClass('active');
14			$('.sticky-posts-active').addClass('post-active');
15			item.addClass('active');
16			//$('.sticky-posts-active').height(($('.sticky-posts-active').height()));
17			//item.height(($('.sticky-posts-active').height()));
18            adjustPostItem_height($('.sticky-posts-active').height());
19			//adjustImageSize();
20
21		}
22
23		function closeSticky() {
24			$('.sticky-posts-active').removeClass('post-active');
25			$(tab_sticky_posts_active + '.sticky-item').removeClass('active');
26
27			adjustImageSize();
28		}
29
30		function runSticky() {
31
32			var current = $(tab_sticky_posts_active + '.sticky-item.active');
33
34			if(!current.length) {
35				var toGo = $(tab_sticky_posts_active + '.sticky-item:first-child');
36			} else {
37				if(current.is(':last-child'))
38					var toGo = $(tab_sticky_posts_active + '.sticky-item:first-child');
39				else
40					var toGo = current.next('.sticky-item');
41			}
42
43			openSticky(toGo.data('postid'));
44
45		}
46        function adjustPostItem_height(h) {
47            var opened = $(tab_sticky_posts_active + '.sticky-item.active');
48			var closed = $(tab_sticky_posts_active + '.sticky-item');
49
50			opened.height(h);
51			//closed.height("100%");   //if enable the mCustomScrollbar
52			closed.height("auto");
53
54            var highestBox = 0;
55            $(".three_per_row").each(function(){
56                if($(this).height() > highestBox)
57                   highestBox = $(this).height();
58            });
59            $(".three_per_row").height(highestBox);
60
61            // Set of the two colum of each posts items in News Container equal height
62            for(var i = 1; i <= $(".two_per_row").length; i+=2) {
63                var next = i+1;
64                var highestCol = Math.max($(".two_per_row"+i).height(),$(".two_per_row"+next).height());
65                $(".two_per_row"+i).height(highestCol);
66                $(".two_per_row"+next).height(highestCol);
67            }
68        }
69		function adjustImageSize() {
70
71			var opened = $(tab_sticky_posts_active + '.sticky-item.active img');
72			var closed = $(tab_sticky_posts_active + '.sticky-item img');
73
74			if(opened.length) {
75				//opened.attr('style', '');
76			}
77
78			closed.each(function() {
79
80				var img = $(this);
81
82				if(!img.parents('.sticky-item').is('.active')) {
83
84					var imgT = setInterval(function() {
85						img.css({
86							//width: img.parents('.sticky-item').innerHeight()-30,
87							//height: img.parents('.sticky-item').innerHeight()-30
88							width: 50,
89							height: 50
90						});
91					}, 10);
92
93					setTimeout(function() {
94						clearInterval(imgT);
95					}, 250);
96
97				} else {
98					img.attr('style', '');
99				}
100
101			});
102
103		}
104
105		$('.sticky-posts .sticky-item').click(function() {
106			clearInterval(t);
107			if(!$(this).is('.active')) {
108				openSticky($(this).data('postid'));
109				return false;
110			} else {
111				window.location = $(this).find('.link').attr('href');
112			}
113		});
114
115		if($('.sticky-posts-active').length) {
116
117			jeo.markerOpened(function() {
118				clearInterval(t);
119				closeSticky();
120			});
121
122			$(tab_sticky_posts_active + '.sticky-item').each(function() {
123				var $item = $(this);
124				$item.data('shareUrl', $(this).find('.share-button').attr('href'));
125				$item.find('.share-button').attr('href', $item.data('shareUrl') + '&map_id=' + map.currentMapID);
126
127			});
128
129			jeo.groupChanged(function(group) {
130
131				$(tab_sticky_posts_active + '.sticky-item').each(function() {
132					var $item = $(this);
133					$item.find('.share-button').attr('href', $item.data('shareUrl') + '&map_id=' + group.currentMapID);
134				});
135
136			});
137
138			map.on('click mouseup', function() {
139				clearInterval(t);
140			});
141
142			setTimeout(function() {
143				openSticky($(tab_sticky_posts_active + '.sticky-item:first-child').data('postid'));
144				t = setInterval(runSticky, 6000);
145			}, 700);
146		}
147
148	});
149
150})(jQuery);

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.