PageSourceSearch

https://elobrero.es/modules/mod_news_pro_gk5/tmpl/portal_modes/videolist/script.jquery.js

js elobrero.es collected 2026-10-02 11:46:24 UTC 3,351 bytes, 127 lines download raw bytes

1jQuery(window).load(function() {
2	setTimeout(function() {
3		jQuery(document).find('.gkNspPM-VideoList').each(function(i, module) {
4			module = jQuery(module);
5			
6			if(!module.hasClass('active')) {
7				module.addClass('active');
8			}
9
10			var mod = new GKNSPVideoList();
11			mod.init(module);
12		});
13	}, 1000);
14});
15
16// module initializer
17var GKNSPVideoList = function(module) {
18	var API = {
19		// basic variables
20		currentPage: 0,
21		blank: false,
22		pagesAmount: 0,
23		itemsAmount: 0,
24		perPage: 0,
25		pages: null,
26		pagination: null,
27		// instance initialization
28		init: function(module) {
29			//
30			// init variables
31			//
32			var $this = this;
33			this.pagesAmount = module.find('.gkItemsPage').length;
34			this.pages = module.find('.gkItemsPage');
35			this.itemsAmount = module.find('.gkItem').length;
36			this.perPage = Math.ceil(this.itemsAmount / this.pagesAmount);
37			this.pagination = module.find('.gkBottomNavPagination li');
38			//
39			// init UI
40			//
41			// video popups
42			module.find('.gkItem').each(function(i, item) {
43				item = jQuery(item);
44				item.find('.gkImageWrap').click(function(e) {
45					e.preventDefault();
46					var target_img = item.find('img');
47					var url = target_img.attr('data-url');
48					
49					if(url != '#') {
50						SqueezeBox.open(url, {handler: 'iframe', size: {x: target_img.attr('data-x'),y: target_img.attr('data-y') }});
51					} else {
52						window.location.href = item.find('h3 a').attr('href');
53					}
54				});
55			});
56			// pagination events
57			if(this.pagination.length > 0) {
58				// next button events
59				jQuery(module.find('.gkBottomNavNext')).click(function(e) {
60					e.preventDefault();
61					$this.next();
62				});
63				// prev button events
64				jQuery(module.find('.gkBottomNavPrev')).click(function(e) {
65					e.preventDefault();
66					$this.prev();
67				});
68				// pagination events
69				jQuery(this.pagination).each(function(i, item) {
70					jQuery(item).click(function(e) {
71						e.preventDefault();
72						$this.page(i);
73					});
74				});
75			}
76		},
77		// skip to next slide
78		next: function() {
79			var num = (this.currentPage < this.pagesAmount - 1) ? this.currentPage + 1 : 0;
80			this.page(num);
81		},
82		// skip to previous slide
83		prev: function() {
84			var num = (this.currentPage > 0) ? this.currentPage - 1 : this.pagesAmount - 1;
85			this.page(num);
86		},
87		// skip to n-th slide
88		page: function(num) {
89			var $this = this;
90			var prev = jQuery(this.pages[this.currentPage]);
91			// hide prev items
92			prev.find('.gkItem').each(function(i, item) {
93				setTimeout(function() {
94					jQuery(item).removeClass('active');
95				}, i * 50);
96			});
97			var prevNum = this.currentPage;
98			// hide current page
99			prev.addClass('to-hide');
100			// get the next page num
101			this.currentPage = num;
102			// active pagination elements
103			if(this.pagination) {
104				jQuery(this.pagination[prevNum]).removeClass('active');
105				jQuery(this.pagination[this.currentPage]).addClass('active');
106			}
107			// hide old page
108			setTimeout(function() {
109				prev.removeClass('active');
110				// show new page
111				jQuery($this.pages[$this.currentPage]).addClass('active');
112				// show next items
113				jQuery($this.pages[$this.currentPage]).find('.gkItem').each(function(i, item) {
114					setTimeout(function() {
115						jQuery(item).addClass('active');
116					}, i * 50);
117				});
118				
119				prev.removeClass('to-hide');
120			}, 500);
121		} 
122	};
123	
124	return API;
125};
126
127// EOF

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.