הבדלים בין גרסאות בדף "מדיה ויקי:Common.js"

מאגר הידע של דואלוג: מאגר הידע המקיף בעברית בתחומי האסטרטגיה והחשיבה המערכתית
קפיצה לניווט קפיצה לחיפוש
שורה 79: שורה 79:
 
// banner
 
// banner
  
$(window).on('load', function() {
 
 
if ($('#image-banner').length > 0) {  
 
if ($('#image-banner').length > 0) {  
 
// replace Breadcrumbs
 
// replace Breadcrumbs
שורה 105: שורה 104:
 
}
 
}
 
}
 
}
});
 
  
$( window ).load(function(){
 
 
if ($('#image-banner').length > 0) {  
 
if ($('#image-banner').length > 0) {  
 
$('#p-logo').addClass("banner");
 
$('#p-logo').addClass("banner");
שורה 114: שורה 111:
 
$( "a.image:first" ).appendTo( "#fullScreen" );
 
$( "a.image:first" ).appendTo( "#fullScreen" );
 
}
 
}
});
+
 
  
 
/* mobile menu */  
 
/* mobile menu */  

גרסה מ־01:25, 8 בינואר 2018

//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);

הודפס מתוך מאגר הידע של דואלוג בכתובת: "https://doalogue.co.il/wiki/index.php?title=מדיה_ויקי:Common.js&oldid=8429"

משותף תחת רישיון CC-BY 4.0. ניתן להפיץ באופן חופשי תוך מתן קרדיט לדואלוג וקישור למקור.