PageSourceSearch

https://kosmopoisk.org/components/com_k2/js/k2.js

js kosmopoisk.org collected 2026-10-02 16:15:59 UTC 3,083 bytes, 105 lines download raw bytes

1/**
2 * @version		$Id: k2.js 478 2010-06-16 16:11:42Z joomlaworks $
3 * @package		K2
4 * @author		JoomlaWorks http://www.joomlaworks.gr
5 * @copyright	Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
6 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
7 */
8
9window.addEvent('domready', function(){
10	
11  // Comments
12  if($('comment-form')) {
13    $('comment-form').addEvent('submit', function(e){
14      new Event(e).stop();
15      var log2 = $('formLog').empty().addClass('formLogLoading');
16      this.send({
17        update: log2,
18        onComplete: function(res){
19          log2.removeClass('formLogLoading');
20  				if(typeof(Recaptcha) != "undefined"){ 
21						Recaptcha.reload();
22  				}
23          if (res.substr(13, 7) == 'success') {
24              window.location.reload();
25          }
26        }
27      });
28    });
29  }
30  
31  // Text Resizer
32  if($('fontDecrease')) {
33		$('fontDecrease').addEvent('click', function(e){
34			new Event(e).stop();
35			$$('.itemFullText').removeClass('largerFontSize');
36			$$('.itemFullText').addClass('smallerFontSize');
37		});
38  }
39  if($('fontIncrease')) {
40		$('fontIncrease').addEvent('click', function(e){
41			new Event(e).stop();
42			$$('.itemFullText').removeClass('smallerFontSize');
43			$$('.itemFullText').addClass('largerFontSize');
44		});
45  }
46  
47  // Smooth Scroll
48  new SmoothScroll({
49      duration: 500,
50      links: 'a.k2Anchor'
51  });
52  	
53	// Rating
54	if($$('.itemRatingForm').length > 0) {
55		$$('.itemRatingForm a').addEvent('click', function(e){
56			e = new Event(e).stop();
57			var itemID = this.getProperty('rel');
58			var log = $('itemRatingLog' + itemID).empty().addClass('formLogLoading');
59			var rating = this.getText();
60			var url = K2RatingURL+"index.php?option=com_k2&view=item&task=vote&user_rating=" + rating + "&itemID=" + itemID;
61			new Ajax(url, {
62				method: "get",
63				update: log,
64				onComplete: function(){
65					log.removeClass('formLogLoading');
66					new Ajax(K2RatingURL+"index.php?option=com_k2&view=item&task=getVotesPercentage&itemID=" + itemID, {
67						method: "get",
68						onComplete: function(percentage){
69							$('itemCurrentRating' + itemID).setStyle('width', percentage + "%");
70							setTimeout(function(){
71								new Ajax(K2RatingURL+"index.php?option=com_k2&view=item&task=getVotesNum&itemID=" + itemID, {
72									method: "get",
73									update: log
74								}).request();
75							}, 2000);
76						}
77					}).request();
78				}
79			}).request();
80		});
81	}
82	
83	$$('.classicPopup').addEvent('click', function(e){
84		e = new Event(e).stop();
85		var options = Json.evaluate(this.getProperty('rel'));
86		window.open(this.getProperty('href'),'K2PopUpWindow','width='+options.x+',height='+options.y+',menubar=yes,resizable=yes');
87	});
88	
89});
90
91window.addEvent('load', function(){
92
93  // Equal block heights for the "default" view
94  if($$('.subCategory')){
95		var blocks = $$('.subCategory');
96		var maxHeight = 0;
97		blocks.each(function(item){
98			maxHeight = Math.max(maxHeight, parseInt(item.getStyle('height')));
99		});
100		blocks.setStyle('height', maxHeight);
101	}
102	
103});
104
105// End

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.