„MediaWiki:Common.js” változatai közötti eltérés

Innen: Sanctum2 Wikipédia
Ugrás a navigációhozUgrás a kereséshez
Nincs szerkesztési összefoglaló
Címke: Kézi visszaállítás
Nincs szerkesztési összefoglaló
 
(18 közbenső módosítás, amit egy másik szerkesztő végzett, nincs mutatva)
1. sor: 1. sor:
// MediaWiki:Common.js
$(document).ready(function() {
$(document).ready(function() {
    // Add search box with styled input
     var footerImage = $('<div id="footer-image"><img src="https://wiki.nw2online.com/skins/monobook/content_foot.png?2017-05-14T14:15:00Z" alt="Footer Image"></div>');
     var searchBoxHtml = '<div id="searchBox" style="position: sticky; top: 0; background-color: #333; padding: 10px; border-radius: 5px; width: 90%; margin-left: auto; margin-right: auto;">' +
     $('#mw-content-text').append(footerImage);
                      '<label for="tableSearch" style="color: #fff; font-size: 1.2em; margin-right: 10px;">Keresés név alapján:</label>' +
                      '<input type="text" id="tableSearch" placeholder="Írd be a tárgy nevét..." style="padding: 5px; border-radius: 5px; border: 1px solid #72716F; color: #333; width: 70%; max-width: 500px;">' +
                      '</div>';
 
    // Insert search box above the "Kép Név Beszerezhetőség" table
    $('.mw-parser-output table.wikitable:first').before(searchBoxHtml);
 
    // Search functionality
     $('#tableSearch').on('keyup', function() {
        var value = $(this).val().toLowerCase();
        $('.mw-parser-output table.wikitable:first tr').filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
        });
    });
});
});


// MediaWiki:Common.js
$(document).ready(function() {
$(document).ready(function() {
    // Add fixed header with logo and search box
     var headerImage = $('<div id="header-image"><img src="https://wiki.nw2online.com/skins/monobook/content_head.png?2017-05-14T14:15:00Z" alt="Header Image"></div>');
     var headerHtml = '<div id="customHeader" style="position: fixed; top: 0; left: 0; right: 0; background-color: #333; color: #fff; padding: 10px; z-index: 1000;">' +
    $('#firstHeading').prepend(headerImage);
                    '<div style="float: left;"><img src="/path/to/logo.png" style="height: 50px;"></div>' +
});
                    '<div style="float: right;"><input type="text" id="searchInput" placeholder="Search..." style="padding: 5px; border-radius: 5px; border: 1px solid #72716F; color: #333; width: 200px;"></div>' +
                    '<div style="clear: both;"></div>' +
                    '</div>';


    // Insert the custom header at the top of the page
    $('#mw-page-base').before(headerHtml);


     // Adjust content margin to prevent overlapping with fixed header
$(document).ready(function() {
     $('#content').css('margin-top', '80px'); // Adjust this value as needed
     var sideImage = $('<div id="side-image"><img src="https://wiki.nw2online.com/skins/newimages/character.png" alt="Side Image"></div>');
     $('#mw-content-text').append(sideImage);
});


     // Search functionality
$(document).ready(function() {
     $('#searchInput').on('keyup', function() {
     // Hozzunk létre egy gombot
        var value = $(this).val().toLowerCase();
     var backButton = $('<button id="back-button" style="position: fixed; bottom: 10px; right: 10px; z-index: 1000;">Vissza az előző oldalra</button>');
        $('.mw-parser-output').find('h2, h3, h4, p').filter(function() {
document.addEventListener("DOMContentLoaded", function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
    // Kép URL-je
        });
    var imageUrl = "https://wiki.nw2online.com/skins/monobook/head.png?2017-05-14T14:15:00Z";
     });
   
    // Kép elem létrehozása és beállítása
    var img = new Image();
    img.src = imageUrl;
    img.alt = "Top Image"; // Alt attribútum a képleíráshoz
    img.style.position = "fixed"; // Fix pozíció a lap tetején
    img.style.top = "0";
    img.style.left = "50%"; // Középre igazítás
    img.style.transform = "translateX(-50%)"; // Középre igazítás
    img.style.zIndex = "1000"; // Biztosítja, hogy a kép a legtetején legyen
    img.style.width = "100%"; // Kép szélessége a teljes képernyő szélessége
   
     // Kép hozzáadása a body elemhez
    document.body.appendChild(img);
});
});


$(document).ready(function() {
//
    var footerImage = $('<div id="footer-image"><img src="https://wiki.nw2online.com/skins/monobook/content_foot.png?2017-05-14T14:15:00Z" alt="Footer Image"></div>');
$(document).ready(function(){
    $('#mw-content-text').append(footerImage);
setDesignCharacter();
setFooterPosition();
setSidebarFlow();
setFootPosition();
setScrollAnimation();
});
});


$(document).ready(function() {
$(window).resize(function(){
    var headerImage = $('<div id="header-image"><img src="https://wiki.nw2online.com/skins/monobook/content_head.png?2017-05-14T14:15:00Z" alt="Header Image"></div>');
setDesignCharacter();
    $('#firstHeading').prepend(headerImage);
setSidebarFlow();
setFootPosition();
});
});


// Kereső gomb létrehozása és működése
$(document).scroll(function(e){
$(document).ready(function() {
pageScrollEvent();
    // Kereső konténer div létrehozása
});
    var searchContainer = $('<div>')
        .attr('id', 'customSearchContainer')
        .css({
            'position': 'fixed',
            'top': '380px', // Előfordulhat, hogy ezt módosítani kell az oldal elrendezésétől függően
            'left': '20px',
            'z-index': '1000'
        });


    // Kereső input mező létrehozása
    var searchInput = $('<input>')
        .attr({
            'type': 'text',
            'id': 'customSearchInput',
            'placeholder': 'Keresés...'
        })
        .css({
            'padding': '10px',
            'margin-right': '10px',
            'border': '1px solid #ccc',
            'border-radius': '5px',
            'font-size': '14px',
            'width': '200px'
        });


    // Kereső gomb létrehozása
var setDesignCharacter = function() {
    var searchButton = $('<div>')
var ww = $(window).width();
        .attr('id', 'customSearchButton')
var character = $('div#fixed_character_design');
        .css({
character.css({
            'background-color': '#0074D9',
visibility: ww > 1220 ? 'visible' : 'hidden',
            'color': 'white',
});
            'cursor': 'pointer',
}
            'padding': '10px',
            'border-radius': '5px'
        })
        .text('Keresés');


    // Kereső gomb és input mező hozzáadása a konténerhez
var setSidebarFlow = function() {
    searchContainer.append(searchInput).append(searchButton);
var wh = $(window).height();
    $('#p-navigation').after(searchContainer); // Az "p-navigation" az oldal navigációs sávját jelöli
var sidebar = $('div.sidebar_top, div#p-logo');
sidebar.css({
position: wh < 700 ? 'absolute' : 'fixed'
});
}


    // Kattintás esemény hozzáadása a kereső gombhoz
var setFootPosition = function() {
    searchButton.click(function() {
var wh = $(window).height();
        var searchTerm = searchInput.val().trim();
var fp = $('div.foot').offset();
        if (searchTerm !== '') {
var body = $('div#bodyContent');
            var searchUrl = mw.config.get('wgScriptPath') + '/index.php?search=' + encodeURIComponent(searchTerm);
var bp = body.offset();
            window.location.href = searchUrl;
$('div#bodyContent').css({
        }
height: fp.top < (wh - 200) ? (wh - bp.top - 310) : 'auto'
    });
});
}


    // Enter lenyomás figyelése a kereső input mezőn
var setFooterPosition = function() {
    searchInput.keypress(function(event) {
var wh = $(window).height();
        if (event.which === 13) { // Enter key pressed
            searchButton.click();
var footer = $('div#footer');
        }
var fp = footer.offset();
    });
var fh = footer.height();
});
if ((wh-fh) > fp.top) {
footer.css({
bottom: 0,
width: '100%',
position: 'fixed',
});
}
footer.css({
visibility: 'visible',
});
}
pageScrollBackgroundValue = 0;
pageScrollLastValue = 0;
var pageScrollEvent = function(e){
var scTop = $(window).scrollTop();
if (Math.abs(scTop - pageScrollLastValue) > 10) {
var dir = scTop < pageScrollLastValue ? 1 : -1;
pageScrollLastValue = scTop;
pageScrollBackgroundValue += 188 * dir;
$('div#p-cactions div.animation').css({
backgroundPosition: '0px ' + pageScrollBackgroundValue + 'px'
});
}
}

A lap jelenlegi, 2024. június 24., 16:21-kori változata

$(document).ready(function() {
    var footerImage = $('<div id="footer-image"><img src="https://wiki.nw2online.com/skins/monobook/content_foot.png?2017-05-14T14:15:00Z" alt="Footer Image"></div>');
    $('#mw-content-text').append(footerImage);
});

$(document).ready(function() {
    var headerImage = $('<div id="header-image"><img src="https://wiki.nw2online.com/skins/monobook/content_head.png?2017-05-14T14:15:00Z" alt="Header Image"></div>');
    $('#firstHeading').prepend(headerImage);
});


$(document).ready(function() {
    var sideImage = $('<div id="side-image"><img src="https://wiki.nw2online.com/skins/newimages/character.png" alt="Side Image"></div>');
    $('#mw-content-text').append(sideImage);
});

$(document).ready(function() {
    // Hozzunk létre egy gombot
    var backButton = $('<button id="back-button" style="position: fixed; bottom: 10px; right: 10px; z-index: 1000;">Vissza az előző oldalra</button>');
document.addEventListener("DOMContentLoaded", function() {
    // Kép URL-je
    var imageUrl = "https://wiki.nw2online.com/skins/monobook/head.png?2017-05-14T14:15:00Z";
    
    // Kép elem létrehozása és beállítása
    var img = new Image();
    img.src = imageUrl;
    img.alt = "Top Image"; // Alt attribútum a képleíráshoz
    img.style.position = "fixed"; // Fix pozíció a lap tetején
    img.style.top = "0";
    img.style.left = "50%"; // Középre igazítás
    img.style.transform = "translateX(-50%)"; // Középre igazítás
    img.style.zIndex = "1000"; // Biztosítja, hogy a kép a legtetején legyen
    img.style.width = "100%"; // Kép szélessége a teljes képernyő szélessége
    
    // Kép hozzáadása a body elemhez
    document.body.appendChild(img);
});

// 
$(document).ready(function(){
			
	setDesignCharacter();
	setFooterPosition();
	setSidebarFlow();
	setFootPosition();
	setScrollAnimation();
});

$(window).resize(function(){
	setDesignCharacter();
	setSidebarFlow();
	setFootPosition();
});

$(document).scroll(function(e){
	pageScrollEvent();
});


var setDesignCharacter = function() {
var ww = $(window).width();
	var character = $('div#fixed_character_design');
	character.css({
		visibility: ww > 1220 ? 'visible' : 'hidden',
	});	
}

var setSidebarFlow = function() {
	var wh = $(window).height();
	var sidebar = $('div.sidebar_top, div#p-logo');
	sidebar.css({
		position: wh < 700 ? 'absolute' : 'fixed'
	});	
}

var setFootPosition = function() {
	var wh = $(window).height();
	var fp = $('div.foot').offset();
	var body = $('div#bodyContent');
	var bp = body.offset();
	$('div#bodyContent').css({
		height: fp.top < (wh - 200) ? (wh - bp.top - 310) : 'auto'
	});
}

var setFooterPosition = function() {
	var wh = $(window).height();
	
	var footer = $('div#footer');	
	var fp = footer.offset();
	var fh = footer.height();
	
	if ((wh-fh) > fp.top) {	
		footer.css({
			bottom: 0,
			width: '100%',
			position: 'fixed',
		});
	}
	footer.css({
		visibility: 'visible',
	});
}
pageScrollBackgroundValue = 0;
pageScrollLastValue = 0;
var pageScrollEvent = function(e){
	var scTop = $(window).scrollTop();
	if (Math.abs(scTop - pageScrollLastValue) > 10) {
		var dir = scTop < pageScrollLastValue ? 1 : -1;
		pageScrollLastValue = scTop;
		pageScrollBackgroundValue += 188 * dir;
		$('div#p-cactions div.animation').css({
			backgroundPosition: '0px ' + pageScrollBackgroundValue + 'px'
		});
	}
}