הבדלים בין גרסאות בדף "מדיה ויקי:Common.js"
קפיצה לניווט
קפיצה לחיפוש
שורה 148: | שורה 148: | ||
e.preventDefault(); | e.preventDefault(); | ||
var aid = $(this).attr("href"); | var aid = $(this).attr("href"); | ||
− | $('html,body').animate({scrollTop: $(aid).offset().top- | + | $('html,body').animate({scrollTop: $(aid).offset().top-100},'slow'); |
}); | }); |
גרסה מ־12:26, 4 במרץ 2020
//DISABLE REDLINKS
if ($('#pt-logout').length == 0) {
$("a[class=new]").removeAttr('href').removeAttr('title');
}
// TOC title: Get the element
if ($(window).width() > 1200) {
var PageHead = document.getElementById("firstHeading");
// Copy the <li> element and its child nodes
var clnPageHead = PageHead.cloneNode(true);
// Append the cloned element to TOC with id="toctitle"
if ($('#toctitle').length > 0) {
document.getElementById("toctitle").appendChild(clnPageHead);
// toc laggy sticky - based over contained sticky scroll: http://blog.echoenduring.com/2010/11/27/making-of-the-contained-sticky-scroll-jquery-plugin/
(function( $ ){
$.fn.containedStickyScroll = function( options ) {
var defaults = {
oSelector : this.selector,
unstick : true,
easing: 'linear',
duration: 0,
queue: false,
closeChar: '',
closeTop: 3,
baroffset: 80,
closeRight: 3
};
var options = $.extend(defaults, options);
if(options.unstick === true){
this.append('<a class="scrollFixIt" title="נעיצה תוכן העניינים בראש העמוד"><i class="fa fa-thumb-tack"></i>' + options.closeChar + '</a>');
jQuery(options.oSelector + ' .scrollFixIt').css('position','absolute');
jQuery(options.oSelector + ' .scrollFixIt').css('top',options.closeTop + 'px');
jQuery(options.oSelector + ' .scrollFixIt').css('right',options.closeTop + 'px');
jQuery(options.oSelector + ' .scrollFixIt').css('cursor','pointer');
jQuery(options.oSelector + ' .scrollFixIt').click(function() {
getObject = options.oSelector;
jQuery(getObject).animate({ top: "0px" },
{ queue: options.queue, easing: options.easing, duration: options.duration });
jQuery(window).unbind();
jQuery('.scrollFixIt').remove();
});
}
jQuery(window).scroll(function() {
getObject = options.oSelector;
if(jQuery(window).scrollTop() > (jQuery(getObject).parent().offset().top - options.baroffset) &&
(jQuery(getObject).parent().height() + jQuery(getObject).parent().position().top - options.baroffset) > (jQuery(window).scrollTop() + jQuery(getObject).height())){
jQuery(getObject).animate({ top: (jQuery(window).scrollTop() - jQuery(getObject).parent().offset().top) + 80 + "px" },
{ queue: options.queue, easing: options.easing, duration: options.duration });
}
else if(jQuery(window).scrollTop() < (jQuery(getObject).parent().offset().top)){
jQuery(getObject).animate({ top: "0px" },
{ queue: options.queue, easing: options.easing, duration: options.duration });
}
});
};
})( jQuery );
jQuery('#toc').containedStickyScroll();
}
}
//mobile menu
var $hideMenu = $('#nav .hideMenu');
var $menuTrigger = $('#nav');
$menuTrigger.on( "tap", function(e) {
$hideMenu.toggle();
e.preventDefault();
});
$("a[href='#.D7.9C.D7.97.D7.A6.D7.95_.D7.9B.D7.90.D7.9F_.D7.9C.D7.A7.D7.91.D7.99.D7.A2.D7.AA_.D7.A4.D7.92.D7.99.D7.A9.D7.AA_.D7.A2.D7.91.D7.95.D7.93.D7.94_.D7.91.D7.A0.D7.95.D7.A9.D7.90_.D7.96.D7.94']").css( "display", "none" );
// banner
if ($('#image-banner').length > 0) {
// replace Breadcrumbs
if ($('#breadcrumbs2').length == 1) {
var BreadCrumbs = document.getElementById("breadcrumbs2");
var clnBreadCrumbs = BreadCrumbs.cloneNode(true);
$( "#breadcrumbs2" ).remove();
document.getElementById("mw-head-base").appendChild(clnBreadCrumbs);
}
$('#image-banner').css('background-image', 'url(' + $('.image img').attr('src') + ')').css('opacity', '1');
var PageHead = document.getElementById("firstHeading");
// Copy the element and its child nodes
var clnPageHead = PageHead.cloneNode(true);
var PageHeader = document.getElementById("image-banner");
var clnPageHeader = PageHeader.cloneNode(true);
if ($('.image').length > 0) {
document.getElementById("image-banner").remove();
$("#header").after(clnPageHeader);
$('#firstHeading').css('display', 'none');
document.getElementById("newHeading").appendChild(clnPageHead);
$('#newHeading #firstHeading').removeAttr('id');
}
}
if ($('#image-banner').length > 0) {
$('#p-logo').addClass("banner");
$('#image-banner').css('opacity', '1');
//$('#fullScreen').attr("href", $('a.image:first').attr('href'));
$( "a.image:first" ).appendTo( "#fullScreen" );
}
/* mobile menu */
if ($(window).width() < 890) {
$("#nav ul").click(function(){
$("#nav ul").toggleClass("active");
});
}
/* Media PAge */
var FileLinkText = $("#firstHeading").text();
$(".filehistory a").html(FileLinkText);
/* סינון מונחון */
$(function() {
var $input = $("input[name='keyword']"),
$context = $("#context ul li");
$outofcontext = $("#context h3 "),
$input.on("input", function() {
var term = $(this).val();
$context.show().unmark();
if (term) {
$context.mark(term, {
done: function() {
$context.not(":has(mark)").hide();
$outofcontext.hide();
}
});
} else {
$outofcontext.show();
}
});
});
$("#heroButton").click(function(e) {
e.preventDefault();
var aid = $(this).attr("href");
$('html,body').animate({scrollTop: $(aid).offset().top-100},'slow');
});