PageSourceSearch

https://diplomaticacademy.am/js/general.js

js diplomaticacademy.am collected 2026-10-08 05:09:38 UTC 8,739 bytes, 302 lines download raw bytes

1var slideshowSpeed = 10000;
2
3jQuery.preloadImages = function()
4{
5  for(var i = 0; i<arguments.length; i++)
6  {
7    jQuery("<img>").attr("src", arguments[i]);
8  }
9}
10
11
12$(document).ready(function() {
13
14	var interval;
15	
16	var activeContainer = 1;	
17	var currentImg = 0;
18	var animating = false;
19	var navigate = function(direction) {
20		if(animating) {
21			return;
22		}
23		
24		if(direction == "next") {
25			currentImg++;
26			if(currentImg == photos.length + 1) {
27				currentImg = 1;
28			}
29		} else {
30			currentImg--;
31			if(currentImg == 0) {
32				currentImg = photos.length;
33			}
34		}
35		
36		var currentContainer = activeContainer;
37		if(activeContainer == 1) {
38			activeContainer = 2;
39		} else {
40			activeContainer = 1;
41		}
42		
43		showImage(photos[currentImg - 1], currentContainer, activeContainer, photos[currentImg]);
44			
45		
46	};
47	
48	$('.albums').mouseover(function(){$(this).toggleClass('albums_bg')});
49	$('.albums').mouseout(function(){$(this).toggleClass('albums_bg')});
50
51	
52	var currentZindex = -1;
53	var showImage = function(photoObject, currentContainer, activeContainer, photo2load) {
54		animating = true;
55		
56		currentZindex--;
57		if(photoObject) {
58			$("#headerimg" + activeContainer).css({
59				"background-image" : "url(" + photoObject.image + ")",
60				"display" : "block",
61				"z-index" : currentZindex
62			});
63		} else {
64			alert('Please upload header images.')
65		}
66		
67		if(photo2load)
68			$.preloadImages(photo2load.image);
69			
70		$("#headerimg" + currentContainer).fadeOut(function() {
71			setTimeout(function() {
72				animating = false;
73			}, 500);
74		});
75	};
76	
77	
78	navigate("next");
79	
80	// Start playing the animation
81	interval = setInterval(function() {
82		navigate("next");
83	}, slideshowSpeed);
84	
85	
86});
87
88var spell_message1 = 'Selected text: '
89var spell_message2 = 'Are you sure you want to send notification?'
90
91function get_selection() {
92		var userSelection;
93		if (window.getSelection) 
94			userSelection = window.getSelection();
95		else if (document.selection) { 
96			userSelection = document.selection.createRange();
97			if (userSelection.text)
98				userSelection = userSelection.text;
99		}
100		var r=confirm(spell_message1 + '"' + userSelection + '"' + '\r\n\r\n' + spell_message2);
101		if (r==true) {
102			location.href.substr(1.4)
103		  $.post("/ajax/spell.php", { page: location.href, spell_text: String(userSelection)});
104		}
105		else
106		  return false;
107}
108
109$(function(){
110	$(window).keypress(function(event) {
111	  if ((event.which == 13 && event.ctrlKey)){
112		  get_selection()
113		  event.preventDefault();
114	  }
115	});
116
117	$('a[href][rel*=external]').each(function(i){this.target = "_blank";});
118
119	$(".slide_menu").click(function() {
120		if(!$(this).next().is(":visible")) {
121			s_m = "selected-menu"
122			
123			$(".level2").slideUp("fast")
124			$(".level2").parent().removeClass(s_m)
125			$(".selected-menu").removeClass(s_m)
126			$(this).next().slideToggle("slow")
127			$(this).parent().toggleClass(s_m)
128		} else {
129			$(this).next().slideUp("slow")
130			$(this).parent().toggleClass(s_m)
131		}
132	})
133	
134	$(".selected-submenu").parent().parent().addClass('selected-menu');
135	$(".selected-submenu").parent().show();
136	
137	$("#alt_block_title").click(function() {
138		$(this).toggleClass("alt_block_bg1");
139		$(this).toggleClass("alt_block_bg2");
140		$("#alt_block_text").slideToggle();
141	})
142});
143
144/* Acoordion on pages */
145$(document).ready(function() {
146$('div.accordionButton').click(function() {
147if($(this).next().is(':visible')) {
148$(this).next().slideUp('normal');
149} else {	
150$(this).next().slideDown('normal');
151$('html,body').animate({scrollTop: $(this).offset().top}, 500);
152}
153});
154$("div.accordionContent").hide();
155});
156/* Acoordion on pages */
157
158/* Easy Tooltip */ 
159(function($) {
160
161	$.fn.easyTooltip = function(options){
162	  
163		// default configuration properties
164		var defaults = {	
165			xOffset: 10,		
166			yOffset: 25,
167			tooltipId: "easyTooltip",
168			clickRemove: false,
169			content: "",
170			useElement: ""
171		}; 
172			
173		var options = $.extend(defaults, options);  
174		var content;
175				
176		this.each(function() {  				
177			var title = $(this).attr("title");				
178			$(this).hover(function(e){											 							   
179				content = (options.content != "") ? options.content : title;
180				content = (options.useElement != "") ? $("#" + options.useElement).html() : content;
181				$(this).attr("title","");									  				
182				if (content != "" && content != undefined){			
183					$("body").append("<div id='"+ options.tooltipId +"'>"+ content +"</div>");		
184					$("#" + options.tooltipId)
185						.css("position","absolute")
186						.css("top",(e.pageY - options.yOffset) + "px")
187						.css("left",(e.pageX + options.xOffset) + "px")						
188						.css("display","none")
189						.fadeIn("fast")
190				}
191			},
192			function(){	
193				$("#" + options.tooltipId).remove();
194				$(this).attr("title",title);
195			});	
196			$(this).mousemove(function(e){
197				$("#" + options.tooltipId)
198					.css("top",(e.pageY - options.yOffset) + "px")
199					.css("left",(e.pageX + options.xOffset) + "px")					
200			});	
201			if(options.clickRemove){
202				$(this).mousedown(function(e){
203					$("#" + options.tooltipId).remove();
204					$(this).attr("title",title);
205				});				
206			}
207		});
208	  
209	};
210
211})(jQuery);
212/* Easy Tooltip */
213
214/* FAQ */
215(function($) { 
216    $.fn.makeFAQ = function(options) {
217        var defaults = {
218            indexTitle: "Index",    // Change to whatever you want to be displayed
219            faqHeader: ":header",   // default grabs any header element - h1,h2, etc...
220            displayIndex: false      // Display Index
221        };
222        var options = $.extend(defaults, options);
223
224        return this.each(function() {
225            // load the parent object only once
226            var $obj = $(this);
227
228            // Get header children using the obj ID
229            var $faqEntries = $obj.children(options.faqHeader);
230			// counting integer - ensures unique id names
231			var i = 0;
232            // enumerate through each entry and perform several tasks
233            $faqEntries.each(function () {
234                // load object only once
235                var $entry = $(this);
236
237                // Get entry name
238                var entryName = $entry.text();
239                // strip whitespaces and special characters
240                var entryNameSafe = entryName.replace(/\W/g,"") + i;
241				// Increment counter
242                i++;
243
244                // build index line for entry
245                var itemHTML = "<li><a id='" + entryNameSafe.toString() + "Index' href='#" + entryNameSafe.toString() + "' >" + entryName + "</a></li>";
246                // append the index line to the index
247                $('#faqindex ul').append(itemHTML);
248
249                // add click event for index entry
250                if(options.displayIndex) {
251                    $('#' + entryNameSafe.toString() + 'Index').click( function(){ 
252                        // slide down the selected index before jumping to the bookmark    
253                        $('#' + entryNameSafe.toString()).next('span').slideDown('fast');
254                        // make sure it gets the faqopened class
255                        $('#' + entryNameSafe.toString()).addClass('faqopened');
256                     });
257                };
258
259                // add class to faq entry content
260                $entry.next("div").addClass('faqcontent');
261
262                // add title, name and id to entry
263                $entry.attr({
264                    title: "Click to expand/collapse",
265                    name: entryNameSafe,
266                    id: entryNameSafe                    
267                    })
268                    // add class
269                    .addClass("faqclosed")
270                    
271                    // Add click event to entry
272                    .click( function() {
273                        $entry.next('div').slideToggle('fast');
274                        $entry.toggleClass('faqopened');
275                        })
276                        // Collapse the span tag of the entry
277                        .next('div').css({ 
278                            display: "none"
279                        });
280            }); // end enumeration of each faq entry
281
282        }); // end this each
283    }; // end function
284})(jQuery);
285/* FAQ */
286
287/* Howtopay modal window */
288$(function() {
289$("a[rel]").overlay(function() {
290var wrap = this.getContent().find("div.wrap");
291if (wrap.is(":empty")) {
292wrap.load(this.getTrigger().attr("href"));
293}
294});
295});
296/* Howtopay modal window */
297
298$(document).ready(function() {
299	$('#stop').click(function() {
300		document.getElementById('videoContainer').pause();
301	});
302});

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.