MediaWiki:Common.js
korna ansiklopedisi sitesinden
Not: Yayımladıktan sonra değişiklikleri görmeniz için tarayıcınızın önbelleğini temizlemeniz gerekebilir.
- Firefox / Safari: Shift tuşuna basılıyken Yeniden Yükle'ye tıklayın ya da Ctrl-F5 ya da Ctrl-R tıklayın (Mac için ⌘-R)
- Google Chrome: Ctrl-Shift-R'ye basın. (Mac için ⌘-Shift-R)
- Edge: Ctrl basılıyken Yenile'ye tıklayın ya da Ctrl-F5'e basın.
/* Buraya konulacak JavaScript kodu sitedeki her kullanıcı için her sayfa yüklendiğinde çalışacaktır */
/* Collapsible toggle */
$(document).ready(function() {
$(".collapsibletoggletext").click(function() {
$(this).parent().children(".collapsibletoggletext").toggleClass("hiddentext");
});
});
/* Cycle forwards or backwards through elements one at a time via click */
$(function(){
$(".cyclesequence").find(".cyclesequencelinknext").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:first").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
$(".cyclesequence").find(".cyclesequencelinkprev").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:last").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
});
/* Click link to show one or more items and hide other items */
$(function() {
$(".morphlink").click(function() {
var correspondingContent = $(this).data("correspondingcontent");
if ($(this).parents(".morphcontainer").length) {
$(this).parents(".morphcontainer").find(".morphcontent").addClass("hiddentext");
if ($("#" + correspondingContent).length) // morphing object uses IDs
$("#" + correspondingContent).removeClass("hiddentext");
else // morphing object uses classes
$("." + correspondingContent).removeClass("hiddentext");
}
else {
if ($("#" + correspondingContent).length) { // morphing object uses IDs
$("#" + correspondingContent).removeClass("hiddentext");
$("#" + correspondingContent).siblings().filter($(".morphcontent")).addClass("hiddentext");
}
else { // morphing object uses classes
$("." + correspondingContent).removeClass("hiddentext");
$("." + correspondingContent).siblings().filter($(".morphcontent")).addClass("hiddentext");
}
}
});
});
document.addEventListener('DOMContentLoaded', function() {
// Sayfada inputbox var mı kontrol et
const form = document.querySelector('.inputbox form');
if (form) {
form.addEventListener('submit', function(e) {
e.preventDefault(); // Normal submit'i iptal et
// Her zaman aynı sayfaya yönlendir
window.location.href = '/wiki/HedefSayfa';
});
}
});