MediaWiki:Common.js: Revizyonlar arasındaki fark
korna ansiklopedisi sitesinden
Gezinti kısmına atlaArama kısmına atla
Değişiklik özeti yok Etiket: Geri alındı |
Değişiklik özeti yok Etiket: Geri alındı |
||
54. satır: | 54. satır: | ||
}); | }); | ||
// MediaWiki:Common.js içine ekle | |||
// | ( function () { | ||
// Bu sitede mw ve jQuery mevcut olmalı. Eğer yoksa çık. | |||
if ( typeof mw === 'undefined' || typeof jQuery === 'undefined' ) return; | |||
// SOURCE_PAGE: bu script sadece bu sayfada çalışacak (wgPageName formatında, boşluk -> underscore) | |||
var SOURCE_PAGE = 'Bildir'; // <-- burayı değiştir: örn. 'Ana_Sayfa' veya 'Özel:MyPage' | |||
// TARGET_PAGE: kullanıcı submit yaptığında yönlendirilecek sayfa (wiki başlığı, normal boşluk kullanabilirsin) | |||
var TARGET_PAGE = 'Alındın_Mı?'; // <-- burayı değiştir: örn. 'Özel:MyRedirectPage' veya 'Hedef Sayfa' | |||
// Çalışma sayfası kontrolü | |||
if ( mw.config.get('wgPageName') !== SOURCE_PAGE ) return; | |||
// Sayfa yüklendiğinde form submitlerini yakala | |||
jQuery(function($){ | |||
var targetUrl = mw.util.getUrl(TARGET_PAGE); | |||
// .inputbox içindeki tüm formları yakala (varsa) | |||
$('.inputbox form').each(function(){ | |||
var $form = $(this); | |||
// Önce aynı handler'ın iki kere eklenmesini engelle | |||
$form.off('submit.redirectFixed'); | |||
$form.on('submit.redirectFixed', function(e){ | |||
e.preventDefault(); // normal InputBox davranışını durdur | |||
// Her zaman hedef sayfaya yönlendir | |||
window.location.href = targetUrl; | |||
}); | |||
}); | }); | ||
} | }); | ||
}); | }() ); |
16.28, 26 Eylül 2025 tarihindeki hâli
/* 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");
}
}
});
});
// MediaWiki:Common.js içine ekle
( function () {
// Bu sitede mw ve jQuery mevcut olmalı. Eğer yoksa çık.
if ( typeof mw === 'undefined' || typeof jQuery === 'undefined' ) return;
// SOURCE_PAGE: bu script sadece bu sayfada çalışacak (wgPageName formatında, boşluk -> underscore)
var SOURCE_PAGE = 'Bildir'; // <-- burayı değiştir: örn. 'Ana_Sayfa' veya 'Özel:MyPage'
// TARGET_PAGE: kullanıcı submit yaptığında yönlendirilecek sayfa (wiki başlığı, normal boşluk kullanabilirsin)
var TARGET_PAGE = 'Alındın_Mı?'; // <-- burayı değiştir: örn. 'Özel:MyRedirectPage' veya 'Hedef Sayfa'
// Çalışma sayfası kontrolü
if ( mw.config.get('wgPageName') !== SOURCE_PAGE ) return;
// Sayfa yüklendiğinde form submitlerini yakala
jQuery(function($){
var targetUrl = mw.util.getUrl(TARGET_PAGE);
// .inputbox içindeki tüm formları yakala (varsa)
$('.inputbox form').each(function(){
var $form = $(this);
// Önce aynı handler'ın iki kere eklenmesini engelle
$form.off('submit.redirectFixed');
$form.on('submit.redirectFixed', function(e){
e.preventDefault(); // normal InputBox davranışını durdur
// Her zaman hedef sayfaya yönlendir
window.location.href = targetUrl;
});
});
});
}() );