PageSourceSearch

https://www.cuketka.cz/wp-content/themes/c3/js/my.js?ver=11.26

js cuketka.cz collected 2026-10-02 07:55:36 UTC 8,163 bytes, 274 lines download raw bytes

1$(document).ready(function(){
2
3// Cufon!
4// ================================================
5
6Cufonize();
7
8// HTML enhancements
9// ================================================
10
11// main nav: fixing wp markup disabilities
12$('#nav-main li:not(.active) a').wrapInner('<span></span>');
13
14// blog: images in articles (on multi) = links to the article
15$('.hfeed .post img').each(function(){
16	var url = $(this).parents('.post').find('.entry-title a').attr('href');
17	$(this).click(function(){
18		window.location = url;
19		return false;
20	});
21});
22
23// fancybox (lightbox)
24$("a[href$='.jpg'], a[href$='.jpeg'], a[href$='.png'], a[href$='.gif']", '#content').attr('rel', 'fancybox-group').fancybox({
25	'transitionIn'	:	'elastic',
26	'transitionOut'	:	'elastic'
27});
28
29$("a.fb-ajax").fancybox({
30	'transitionIn' : 'fade',
31	'transitionOut' : 'elastic',
32	'speedIn' : 600,
33	'speedOut' : 200,
34	'autoDimensions' : false,
35	'width' : 400
36});
37
38
39
40// Mr. Cuketka's post always first on HP
41// var $first_art = $('body.home:not(.paged) #content article:eq(0)');
42// if ($first_art.find('span.by-readers').length);
43
44
45// Comments and Forum posts
46// ================================================
47
48// pre-check DOM objects
49user_is_logged = user_is_logged||false;
50topic_open = topic_open||false;
51comments_open = comments_open||false;
52
53if ($('#comments').length > 0) { // blog
54	$reply_context = $('#comments');
55	$reply_form = $('form', $reply_context);
56}
57else if ($('#content > div.topic').length > 0) { // forum
58	$reply_context = $('#content > div.topic');
59	$reply_form = $('.reply-area', $reply_context);
60}
61
62if (typeof $reply_context != "undefined") {
63
64
65	// reply link
66	if (comments_open) // @todo rewrite (why?)
67		$('#comments .comment').append('<div class="reply" title="Reagovat na tento komentář">Reagovat</div>');
68	else if (topic_open && user_is_logged)
69		$('.topic .comment').append('<div class="reply" title="Reagovat na tento příspěvek">Reagovat</div>');
70
71	// reply event
72	$('.comment .reply').click(function(){
73
74		// move form
75		$reply_form.insertAfter($(this).parent('.comment')).addClass('in-context');
76
77		// add text into textarea
78		var $ta = $('textarea', $reply_form);
79		var insert = '';
80
81		if ($ta.attr('value'))
82			insert += "\n\n";
83
84		insert += '@' + $(this).parent('.comment').find('.number').text().replace('.', '');
85		insert += ' ' + $(this).parent('.comment').find('.author').text() + ': '; // @todo @next fix in forum
86
87		$ta.attr('value', $ta.attr('value') + insert); //.focus().attr('id', 'comment-ta');
88		setCaretPosition($ta[0], 10000);
89
90		// add placeholder at the orig. position of the form
91		if (!$(' > section.form-placeholder', $reply_context).length) {
92			$reply_context.append('<section class="form-placeholder"><button>Přidat svůj komentář</button></section>');
93			Cufonize();
94
95			// placeholder click event
96			$('section.form-placeholder button').click(function(){
97				var $t = $(this).parent();
98				$reply_form.insertAfter($t).removeClass('in-context');
99				$t.remove();
100				$ta.focus();
101			});
102		}
103
104	});
105
106	// replies
107
108	// Add reply-links (A->B)
109	$('.entry-content a[href^="#"]', '#comments').each(function(i){ // each B->A reply link
110
111		$parent = $(this).parents('article:eq(0)');
112
113		// get A (id = href)
114		if ( ! $( $(this).attr('href') ).find('.replies').length )
115			$( $(this).attr('href') ).find('.entry-content').append('<div class="replies"></div>');
116
117		$( $(this).attr('href') ).find('.replies')
118			.append('<a href="#'+ $parent.attr('id') +'">↪&nbsp;'+ $parent.find('.number').text().replace('.', '') +'</a> ');
119	});
120
121
122}
123
124// ----------------------------------------------------------------------------------------------------
125// FORUM pagination
126if ($('.nav-pagination > .original').length) {
127
128	$('.nav-pagination > .original').each(function(i){
129
130		if (!$('>*', $(this)).length) {
131			//continue; // :-)
132		} else {
133			var prev = $('a.prev', $(this));
134			var next = $('a.next', $(this));
135
136			if (prev.length)
137				prev.attr('title', 'Předchozí stránka').wrapInner('span').wrap('<span class="prev"></span>').parent().insertAfter($(this));
138			else
139				$(this).after('<span class="prev"></span>');
140
141			if (next.length)
142				next.attr('title', 'Další stránka').wrapInner('span').wrap('<span class="next"></span>').parent().insertAfter($(this));
143			else
144				$(this).after('<span class="next"></span>');
145
146			var last = $('a:last-child', $(this)).text();
147			if (last == '') last = $('span:last-child', $(this)).text();
148			var current = $('span.current', $(this)).text();
149			$(this).parent().find('.max').text(last);
150
151			$(this).remove();
152
153		}
154
155	});
156}
157
158// FORUM: add tags form toggling
159if (user_is_logged) {
160	$('#topic-page .topic-meta .tag-form').hide();
161
162	$('#topic-page .topic-meta .tags').append('<button>+</button>').find('button').click(function(){
163		$(this).hide();
164		$(this).parents('.topic-meta').find('.tag-form').show().find('input[type="text"]').focus();
165	});
166}
167
168
169
170// Alternative background --------------------------------------------------------
171
172// Switch onClick
173var back_count = 2;
174$('#corner').click(function(e){
175	e.preventDefault();
176	if ($.cookie('back')) {
177		var old_back = parseInt($.cookie('back'));
178		var new_back = (old_back > (back_count-1)) ? '1' : old_back+1;
179		$.cookie('back', new_back, {expires: 30, path: '/'});
180	} else {
181		$.cookie('back', '2', {expires: 30, path: '/'});
182		new_back = 2;
183	}
184	updateBack(new_back); // set class body.back-[1-2]
185});
186
187function updateBack (new_back) {
188	var new_class = $('body').attr('class').replace(/(^|\s)(\s)?(back\-([0-9])+)(\s|$)/, '$1$5') + ' back-' + new_back;
189	$('body').attr('class', new_class);
190}
191
192	var $searchButton = $('#search-button'),
193		$searchCloseButton = $('#search-close-button'),
194		$search = $('#search'),
195		$html = $('html');
196
197  $searchCloseButton.click(function(e) {
198    e.preventDefault();
199    $search.removeClass('show');
200  });
201
202  $searchButton.click(function(e) {
203		e.preventDefault();
204		$search.addClass('show');
205	});
206
207	$html.click(function(e) {
208			if ($search.hasClass('show')
209				&& !jQuery(e.target).is('#search-button')
210				&& !jQuery(e.target).is('.show')
211				&& !jQuery(e.target).closest('.show').length) {
212				$search.removeClass('show');
213			}
214		}
215	);
216
217
218}); // ready
219
220
221function Cufonize () {
222	// if (!(/MSIE ((5\\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32")) {
223		$('#content section.ad h2').addClass('no-cufon');
224		Cufon.replace('h1, #content h2:not(.no-cufon), section.user h2, #content h3, h4, h5, h6, #nav-main li a, .post .entry-title, .post a.more, #comments section.form-placeholder button');
225	// }
226}
227
228function setCaretPosition(ctrl, pos) {
229
230	if(ctrl.setSelectionRange)
231	{
232		ctrl.focus();
233		ctrl.setSelectionRange(pos,pos);
234	}
235	else if (ctrl.createTextRange) {
236		var range = ctrl.createTextRange();
237		range.collapse(true);
238		range.moveEnd('character', pos);
239		range.moveStart('character', pos);
240		range.select();
241	}
242}
243
244// @todo try plugin "serial scroll" http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
245//
246// $(document).keypress(function(event) {
247// 	console.log(event.keyCode);
248// 	if (event.keyCode == '106' || event.keyCode == '32') {
249// 		if (! $('#comments article.active').length) { // is no active yet
250// 			console.log('A');
251// 			$('#comments article:eq(0)').addClass('active').focus();
252// 		} else {
253// 			if ($('#comments article.active').next('article').is('article')) { // is not last -> select next
254// 				$('#comments article.active').next('article').addClass('active').focus();
255// 				$('#comments article.active:eq(0)').removeClass('active');
256// 				$.scrollTo($('#comments article.active:eq(0)'), 0);
257// 			}
258//
259// 		}
260// 	} else if (event.keyCode == '107') {
261// 		if (! $('#comments article.active').length) { // is no active yet
262// 			console.log('A');
263// 			$('#comments article:eq(0)').addClass('active').focus();
264// 		} else {
265// 			if ($('#comments article.active').prev('article').is('article')) { // is not last -> select next
266// 				$('#comments article.active').prev('article').addClass('active').focus().scrollTo();
267// 				$('#comments article.active:eq(1)').removeClass('active');
268// 				// $.scrollTo($('#comments article.active:eq(0)')-100, 0);
269// 			}
270//
271// 		}
272// 	}
273//
274// });

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.