MediaWiki:Common.js
Not: Sayfayı kaydettikten sonra değişiklikleri görebilmek için tarayıcınızın önbelleğinizi temizlemeniz gerekir. Google Chrome, Firefox, Microsoft Edge ve Safari: ⇧ Shift tuşuna basılı tutun ve Yeniden Yükle araç çubuğu düğmesine tıklayın. Ayrıntılar ve diğer tarayıcılara yönelik yönergeler için Vikipedi:Önbelleğinizi atlayın sayfasını inceleyin.
mw.loader.using([
'mediawiki.util'
], function() {
/**
* Redirect bad mirrors for tr.wikipedia.org
* @author [[m:User:Hoo man]]
*/
var i, isBad,
badMirrors = [
'0wikipedia.org'
];
for (i = 0; i < badMirrors.length; i++) {
if (location.href.indexOf(badMirrors[i]) !== -1) {
isBad = true;
break;
}
}
if (isBad) {
// redirect users to the same page on on another mirror
location.href = '//tr.akademik.info/wiki/' + mw.config.get('wgPageName');
// redirect users to a landing page
//location.href = '//tr.wikipedia.org/wiki/Wikipedia:Live_mirror';
}
/**
* Redirect User:Name/skin.js and skin.css to the current skin's pages
* (unless the 'skin' page really exists).
*
* Dependencies: mediawiki.util
*
* @source www.mediawiki.org/wiki/Snippets/Redirect_skin.js
* @revision 2014-05-19
*/
if (mw.config.get('wgArticleId') === 0 && mw.config.get('wgNamespaceNumber') === 2) {
var titleParts = mw.config.get('wgPageName').split('/');
// Make sure there was a part before and after the slash
// And that the latter is 'skin.js' or 'skin.css'
if (titleParts.length == 2) {
var userSkinPage = titleParts[0] + '/' + mw.config.get('skin');
if (titleParts[1] === 'skin.js') {
location.href = mw.util.getUrl(userSkinPage + '.js');
} else if (titleParts[1] === 'skin.css') {
location.href = mw.util.getUrl(userSkinPage + '.css');
}
}
}
/**
* Extract a URL parameter from the current URL
* From [[en:User:Lupin/autoedit.js]].
*
* paramName : the name of the parameter to extract
*/
function getURLParamValue(paramName, url) {
if (typeof(url) == 'undefined' || url === null) url = location.href;
var cmdRe = RegExp('[&?]' + paramName + '=([^&#]*)'); // Stop at hash
var m = cmdRe.exec(url);
if (m && m.length > 1) return decodeURIComponent(m[1]);
return null;
}
/**
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @revision 2014-05-02
*/
(function() {
var extraJS = mw.util.getParamValue('withJS');
if (extraJS) {
if (extraJS.match(/^MediaWiki:[^&<>=%#]*\.js$/)) {
importScript(extraJS);
} else {
mw.notify('Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' });
}
}
}());
/**
* Import more specific scripts if necessary
*/
if (mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' || mw.config.get('wgCanonicalSpecialPageName') === 'Upload') {
// scripts specific to editing pages
importScript('MediaWiki:Common.js/edit.js');
} else if (mw.config.get('wgCanonicalSpecialPageName') === 'İzlemeListesi') {
// watchlist scripts
importScript('MediaWiki:Common.js/watchlist.js');
}
/**
* WikiMiniAtlas is a popup click and drag world map.
* See [[meta:WikiMiniAtlas]] for more information.
* Maintainers: [[w:User:Dschwen]]
*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript');
/**
* Test if an element has a certain class
*
* @deprecated Use jQuery instead.
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = (function() {
var reCache = {};
return function(element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/**
* Interwiki links to featured articles
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:R. Koot]]
*/
function LinkFA() {
if (document.getElementById('p-lang')) {
var InterwikiLinks = document.getElementById('p-lang').getElementsByTagName('li');
for (var i = 0; i < InterwikiLinks.length; i++) {
var className = InterwikiLinks[i].className.match(/interwiki-[-\w]+/);
if (document.getElementById(className + '-fa') && InterwikiLinks[i].className.indexOf('badge-featuredarticle') === -1) {
InterwikiLinks[i].className += ' FA';
InterwikiLinks[i].title = 'Bu madde başka bir dilde seçkin madde statüsündedir.';
} else if (document.getElementById(className + '-ga') && InterwikiLinks[i].className.indexOf('badge-goodarticle') === -1) {
InterwikiLinks[i].className += ' GA';
InterwikiLinks[i].title = 'Bu madde başka bir dilde kaliteli madde statüsündedir.';
}
}
}
}
mw.hook('wikipage.content').add(LinkFA);
/**
* Collapsible tables; reimplemented with mw-collapsible
* Styling is also in place to avoid FOUC
*
* Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].
* @version 3.0.0 (2018-05-20)
* @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
* @author [[User:R. Koot]]
* @author [[User:Krinkle]]
* @author [[User:TheDJ]]
* @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
* is supported in MediaWiki core. Shimmable since MediaWiki 1.32
*
* @param {jQuery} $content
*/
function makeCollapsibleMwCollapsible($content) {
var $tables = $content
.find('table.collapsible:not(.mw-collapsible)')
.addClass('mw-collapsible');
$.each($tables, function(index, table) {
// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
if ($(table).hasClass('collapsed')) {
$(table).addClass('mw-collapsed');
// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
}
});
if ($tables.length > 0) {
mw.loader.using('jquery.makeCollapsible').then(function() {
$tables.makeCollapsible();
});
}
}
mw.hook('wikipage.content').add(makeCollapsibleMwCollapsible);
/**
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
*
* Maintainers: TheDJ
*/
function mwCollapsibleSetup($collapsibleContent) {
var $element,
$toggle,
autoCollapseThreshold = 2;
$.each($collapsibleContent, function(index, element) {
$element = $(element);
if ($element.hasClass('collapsible')) {
$element.find('tr:first > th:first').prepend($element.find('tr:first > * > .mw-collapsible-toggle'));
}
if ($collapsibleContent.length >= autoCollapseThreshold && $element.hasClass('autocollapse')) {
$element.data('mw-collapsible').collapse();
} else if ($element.hasClass('innercollapse')) {
if ($element.parents('.outercollapse').length > 0) {
$element.data('mw-collapsible').collapse();
}
}
// because of colored backgrounds, style the link in the text color
// to ensure accessible contrast
$toggle = $element.find( '.mw-collapsible-toggle' );
if ( $toggle.length ) {
// Make the toggle inherit text color (Updated for T333357 2023-04-29)
if ( $toggle.parent()[ 0 ].style.color ) {
$toggle.css( 'color', 'inherit' );
$toggle.find( '.mw-collapsible-text' ).css( 'color', 'inherit' );
}
}
});
}
mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup);
/**
* Dynamic Navigation Bars (experimental)
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
var collapseCaption = 'gizle';
var expandCaption = 'göster';
// Set up the words in your language
var navigationBarHide = '[' + collapseCaption + ']';
var navigationBarShow = '[' + expandCaption + ']';
/**
* Shows and hides content and picture (if available) of navigation bars.
*
* @param {number} indexNavigationBar The index of navigation bar to be toggled
* @param {jQuery.Event} event Event object
* @return {boolean}
*/
function toggleNavigationBar(indexNavigationBar, event) {
var navToggle = document.getElementById('NavToggle' + indexNavigationBar);
var navFrame = document.getElementById('NavFrame' + indexNavigationBar);
var navChild;
if (!navFrame || !navToggle) {
return false;
}
// If shown now
if (navToggle.firstChild.data === navigationBarHide) {
for (navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling) {
if ($(navChild).hasClass('NavContent')) {
navChild.style.display = 'none';
}
}
navToggle.firstChild.data = navigationBarShow;
// If hidden now
} else if (navToggle.firstChild.data === navigationBarShow) {
for (navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling) {
if ($(navChild).hasClass('NavContent')) {
navChild.style.display = 'block';
}
}
navToggle.firstChild.data = navigationBarHide;
}
event.preventDefault();
}
/**
* Dynamic Navigation Bars (experimental)
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
/* set up the words in your language */
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
/**
* Shows and hides content and picture (if available) of navigation bars
* Parameters:
* indexNavigationBar: the index of navigation bar to be toggled
**/
window.toggleNavigationBar = function(indexNavigationBar, event) {
var NavToggle = document.getElementById('NavToggle' + indexNavigationBar);
var NavFrame = document.getElementById('NavFrame' + indexNavigationBar);
var NavChild;
if (!NavFrame || !NavToggle) {
return false;
}
/* if shown now */
if (NavToggle.firstChild.data === NavigationBarHide) {
for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if ($(NavChild).hasClass('NavContent') || $(NavChild).hasClass('NavPic')) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
/* if hidden now */
} else if (NavToggle.firstChild.data === NavigationBarShow) {
for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if ($(NavChild).hasClass('NavContent') || $(NavChild).hasClass('NavPic')) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
event.preventDefault();
};
/**
* Add show/hide-button to navigation bars
*/
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
var NavFrame;
var NavChild;
/* iterate over all < div >-elements */
var divs = document.getElementsByTagName('div');
for (var i = 0;
(NavFrame = divs[i]); i++) {
/* if found a navigation bar */
if ($(NavFrame).hasClass('NavFrame')) {
indexNavigationBar++;
var NavToggle = document.createElement('a');
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', '#');
$(NavToggle).on('click', $.proxy(window.toggleNavigationBar, window, indexNavigationBar));
var isCollapsed = $(NavFrame).hasClass('collapsed');
/**
* Check if any children are already hidden. This loop is here for backwards compatibility:
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
* to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
* the content visible without JavaScript support), the new recommended way is to add the class
* "collapsed" to the NavFrame itself, just like with collapsible tables.
*/
for (NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
if ($(NavChild).hasClass('NavPic') || $(NavChild).hasClass('NavContent')) {
if (NavChild.style.display === 'none') {
isCollapsed = true;
}
}
}
if (isCollapsed) {
for (NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if ($(NavChild).hasClass('NavPic') || $(NavChild).hasClass('NavContent')) {
NavChild.style.display = 'none';
}
}
}
var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
NavToggle.appendChild(NavToggleText);
/* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
for (var j = 0; j < NavFrame.childNodes.length; j++) {
if ($(NavFrame.childNodes[j]).hasClass('NavHead')) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
}
mw.hook('wikipage.content').add(createNavigationBarToggleButton);
/**
* Main Page layout fixes
*
* Description: Adds an additional link to the complete list of languages available.
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/
if (mw.config.get('wgIsMainPage')) {
$(function() {
mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'Tam liste', 'interwiki-completelist', 'Vikipedilerin tam listesi'
);
});
}
/**
* Swap message for non-autoconfirmed users at [[Wikipedia:Upload]].
*
* Maintainers: [[User:Krimpet]]
*/
function uploadwizard_newusers() {
if (mw.config.get("wgNamespaceNumber") == 4 && mw.config.get("wgTitle") == "Yükle" && mw.config.get("wgAction") == "view") {
var oldDiv = document.getElementById("autoconfirmedusers"),
newDiv = document.getElementById("newusers");
if (oldDiv && newDiv) {
if (typeof mw.config.get("wgUserGroups") == "object" && mw.config.get("wgUserGroups")) {
for (i = 0; i < mw.config.get("wgUserGroups").length; i++) {
if (mw.config.get("wgUserGroups")[i] == "autoconfirmed") {
oldDiv.style.display = "block";
newDiv.style.display = "none";
return;
}
}
}
oldDiv.style.display = "none";
newDiv.style.display = "block";
return;
}
}
}
$(uploadwizard_newusers);
/**
* Magic editintros
*
* Description: Adds editintros on disambiguation pages and BLP pages.
* Maintainers: [[User:RockMFR]]
*/
function addEditIntro(name) {
var el = document.getElementById('ca-edit');
if (!el)
return;
el = el.getElementsByTagName('a')[0];
if (el)
el.href += '&editintro=' + name;
}
if (mw.config.get('wgNamespaceNumber') == 0) {
$(function() {
if (document.getElementById('villagebox'))
addEditIntro('Template:Village_editintro');
});
$(function() {
if (document.getElementById('disambigbox'))
addEditIntro('Template:Disambig_editintro');
});
$(function() {
var cats = document.getElementById('mw-normal-catlinks');
if (!cats)
return;
cats = cats.getElementsByTagName('a');
for (var i = 0; i < cats.length; i++) {
if (cats[i].title == 'Kategori:Yaşayan insanlar' || cats[i].title == 'Kategori:Possibly living people') {
addEditIntro('Template:BLP_editintro');
break;
}
}
});
}
// Modüler anasayfa için geçici bir tepegöz eklemesi
function addEditIntro2(name) {
var el = document.getElementById('ca-edit');
if (!el)
return;
el = el.getElementsByTagName('a')[0];
if (el)
el.href += '&editintro=' + name;
}
if (mw.config.get('wgNamespaceNumber') == 2) {
$(function() {
var cats = document.getElementById('mw-normal-catlinks');
if (!cats)
return;
cats = cats.getElementsByTagName('a');
for (var i = 0; i < cats.length; i++) {
if (cats[i].title == 'Kategori:Vikiproje Anasayfa 2020 modüler anasayfa tasarımları') {
addEditIntro2('Vikiproje:Anasayfa/2020/Mod%C3%BCler/Tepeg%C3%B6z_2');
break;
}
}
});
}
// Sidebar Değişiklikleri
function ModifySidebar(action, section, name, link) {
try {
switch (section) {
case "diğer diller":
var target = "p-lang";
break;
case "araçlar":
var target = "p-tb";
break;
case "gezinti":
var target = "p-navigation";
break;
default:
var target = "p-" + section;
break;
}
if (action == "add") {
var node = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement('a');
var liNode = document.createElement('li');
aNode.appendChild(document.createTextNode(name));
aNode.setAttribute('href', link);
liNode.appendChild(aNode);
liNode.className = 'plainlinks';
node.appendChild(liNode);
}
if (action == "remove") {
var list = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var listelements = list.getElementsByTagName('li');
for (var i = 0; i < listelements.length; i++) {
if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
listelements[i].getElementsByTagName('a')[0].href == link) {
list.removeChild(listelements[i]);
}
}
}
} catch (e) {
// lets just ignore what's happened
return;
}
}
function CustomizeModificationsOfSidebar() {
//removes [[Özel:Yükle]] from toolbox
ModifySidebar("remove", "araçlar", "Dosya yükle", "//tr.wikipedia.org/wiki/Özel:Yükle");
//adds [[Vikipedi:Yükle]] to toolbox
ModifySidebar("add", "araçlar", "Dosya yükle", "//tr.wikipedia.org/wiki/Vikipedi:Yükle");
}
$(CustomizeModificationsOfSidebar);
/**
* Şablon:Kaydırmalı galeri için
*/
function toggleImage(group, remindex, shwindex) {
document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style.display = "none";
document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style.display = "inline";
}
function ImageGroup() {
if (document.URL.match(/printable/g)) return;
var divs = document.getElementsByTagName("div");
var i = 0,
j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length; i++) {
if (divs[i].className != "ImageGroup") continue;
UnitNode = undefined;
search = divs[i].getElementsByTagName("div");
for (j = 0; j < search.length; j++) {
if (search[j].className != "ImageGroupUnits") continue;
UnitNode = search[j];
break;
}
if (UnitNode == undefined) continue;
units = Array();
for (j = 0; j < UnitNode.childNodes.length; j++) {
var temp = UnitNode.childNodes[j];
if (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) units.push(temp);
}
for (j = 0; j < units.length; j++) {
currentimage = units[j];
wrap = document.createElement('div');
wrap.id = "ImageGroupsGr" + i + "Im" + j;
currentimage.parentNode.insertBefore(wrap, currentimage);
wrap.appendChild(currentimage);
var imghead = document.createElement("div");
var leftlink = document.createElement("a");
var rightlink = document.createElement("a");
if (j != 0) {
leftlink.href = "javascript:toggleImage(" + i + "," + j + "," + (j - 1) + ");";
leftlink.innerHTML = "◀";
}
if (j != units.length - 1) {
rightlink.href = "javascript:toggleImage(" + i + "," + j + "," + (j + 1) + ");";
rightlink.innerHTML = "▶";
}
var comment = document.createElement("tt");
comment.innerHTML = "(" + (j + 1) + "/" + units.length + ")";
with(imghead) {
style.fontSize = "110%";
style.fontweight = "bold";
appendChild(leftlink);
appendChild(comment);
appendChild(rightlink);
}
if (units.length > 1) wrap.insertBefore(imghead, wrap.childNodes[0]);
if (j != 0) wrap.style.display = "none";
}
}
}
$(ImageGroup);
/*
The ajax transclusion table script adds a "[show]" link in the first cell of every row in tables
with the "attable" class. Clicking the link will display the linked page below. No show/hide link
will be shown in rows that don't contain a link, like headings.
*/
/* global $, mw */
/* jshint eqeqeq: true, latedef: true, nocomma: true, undef: true */
var pathoschild = pathoschild || {};
$(function() {
"use strict";
if (pathoschild.ajaxTransclusionTables)
return; // already initialised, don't overwrite
/**
* Singleton responsible for handling ajax transclusion tables.
* @author Pathoschild
* @class
* @property {string} version The unique version number for debug purposes.
*/
pathoschild.ajaxTransclusionTables = (function() {
var self = {};
/*********
** Fields
*********/
self.version = "0.2";
/*********
** Private methods
*********/
var _toggle = function() {
// read toggle
var toggle = $(this);
var data = toggle.data();
// toggle transclusion
if (data.expanded) {
$(data.container).remove();
toggle.text("[göster] ").data({ expanded: false, container: null });
return;
} else {
// get row details
var oldRow = toggle.closest("tr");
var rowID = "att-" + (new Date()).getTime();
var colspan = oldRow.find("> td").length;
// update UI
toggle.text("[gizle] ").data({ expanded: true, container: "#" + rowID });
var newDiv = $('<div class="att-container">').appendTo(
$("<td>").attr("colspan", colspan).appendTo(
$("<tr>").attr("id", rowID).insertAfter(oldRow)
)
);
newDiv.append($("<img>").attr("src", "https://upload.wikimedia.org/wikipedia/commons/d/d2/Spinning_wheel_throbber.gif"));
$.ajax(mw.config.get("wgServer") + "/wiki/" + data.title + "?action=render").then(function(data) {
newDiv.html(data);
});
}
};
/*********
** Public methods
*********/
/**
* Bootstrap and hook into the UI. This method should only be called once the DOM is ready.
*/
self.initialise = function() {
// find cells to inject
var rows = $("table.attable tr");
if (!rows.length)
return;
// add styles
mw.util.addCSS(
".att-container { margin:0.5em; padding:0.5em; border:2px solid gray; }" +
".att-toggle { font-size:0.9em; cursor:pointer; }"
);
// inject links
var toggle = $("<a>").addClass("att-toggle").text("[göster] ");
rows.each(function(i, row) {
// get title to transclude
row = $(row);
var cell = row.find("td:first");
var link = cell.find("a:first");
var title = link.attr("title");
if (!link.length || !link.attr("href").match(/^\/wiki/) || !title)
return;
// inject toggle
cell.prepend(
toggle.clone().data({ title: title, expanded: false }).click(_toggle)
);
});
};
$.when($.ready, mw.loader.using("mediawiki.util")).done(self.initialise);
return self;
})();
});
// End of mw.loader.using
});
/**
* Ana sayfa tasarimi
* Maintainer: [[User:Mavrikant]]
*/
if ($('.wiki-material-ust').length) {
/*Ana sayfa tasarimi buradan basliyor*/
$('div[id^=pick-]').click(function() {
var name = this.id.substring(5);
$(".wiki-material-ust").attr("class", "wiki-material-ust " + name);
$(".wiki-material-box .header:not(.gunun-resmi)").attr("class", "header " + name);
});
function gsrayar() {
$(".wiki-material-ust .portal-back").css("top", ($(".wiki-material-ust").position().top) + "px");
}
$(".wiki-material-ust .portal-back").css("top", ($(".wiki-material-ust").position().top) + "px");
$(window).resize(function() {
if (window.outerWidth <= 1030) {
$(".wiki-material-ust .hos-geldiniz .yazi").css("font-size", "0.6em");
} else {
$(".wiki-material-ust .hos-geldiniz .yazi").removeAttr("style");
}
$(".wiki-material-ust .portal-back").css("top", ($(".wiki-material-ust").position().top) + "px");
gsrayar();
});
$(".wiki-material-ust .portal-box #science").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-science");
});
$(".wiki-material-ust .portal-box #physics").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-physics");
});
$(".wiki-material-ust .portal-box #physics").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #sport").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-sport");
});
$(".wiki-material-ust .portal-box #sport").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #geography").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-geography");
});
$(".wiki-material-ust .portal-box #geography").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #math").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-math");
});
$(".wiki-material-ust .portal-box #math").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #religion").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-religion");
});
$(".wiki-material-ust .portal-box #religion").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #art").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-art");
});
$(".wiki-material-ust .portal-box #art").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-ust .portal-box #history").mouseenter(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-history");
});
$(".wiki-material-ust .portal-box #history").mouseleave(function() {
$(".wiki-material-ust .portal-back").attr("class", "portal-back portal-back-normal");
});
$(".wiki-material-box div.center-box #createbox p br").remove();
/*Ana sayfa tasarimi burada bitiyor*/
}
/** Skript für [[Vorlage:Galerie]] */
$(function() {
if (document.URL.match(/printable/g)) return;
function toggleImageFunction(group, remindex, shwindex) {
return function() {
document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style["display"] = "none";
document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style["display"] = "block";
return false;
};
}
var divs = document.getElementsByTagName("div");
var i = 0,
j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length; i++) {
if (divs[i].className !== "ImageGroup") { continue; }
UnitNode = undefined;
search = divs[i].getElementsByTagName("div");
for (j = 0; j < search.length; j++) {
if (search[j].className !== "ImageGroupUnits") { continue; }
UnitNode = search[j];
break;
}
if (UnitNode === undefined) { continue; }
units = [];
for (j = 0; j < UnitNode.childNodes.length; j++) {
var temp = UnitNode.childNodes[j];
if (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) { units.push(temp); }
}
var rightlink = undefined;
var commentText = undefined;
for (j = 0; j < units.length; j++) {
currentimage = units[j];
wrap = document.createElement('div');
wrap.id = "ImageGroupsGr" + i + "Im" + j;
currentimage.parentNode.insertBefore(wrap, currentimage);
wrap.appendChild(currentimage);
var leftlink = document.createElement("a");
if (commentText !== undefined) {
leftlink.setAttribute("title", commentText);
}
var comment;
if (typeof(currentimage.getAttribute("title")) !== "string") {
commentText = (j + 1) + "/" + units.length;
comment = document.createElement("tt").appendChild(document.createTextNode("(" + commentText + ")"));
} else {
commentText = currentimage.getAttribute("title");
comment = document.createElement("span").appendChild(document.createTextNode(commentText));
currentimage.removeAttribute("title");
}
if (rightlink !== undefined) {
rightlink.setAttribute("title", commentText);
}
var imghead = document.createElement("div");
rightlink = document.createElement("a");
if (j !== 0) {
leftlink.href = "#";
leftlink.onclick = toggleImageFunction(i, j, j - 1);
leftlink.appendChild(document.createTextNode("◀"));
}
if (j !== units.length - 1) {
rightlink.href = "#";
rightlink.onclick = toggleImageFunction(i, j, j + 1);
rightlink.appendChild(document.createTextNode("▶"));
}
imghead.style["fontSize"] = "110%";
imghead.style["fontweight"] = "bold";
imghead.appendChild(leftlink);
imghead.appendChild(document.createTextNode("\xA0"));
imghead.appendChild(comment);
imghead.appendChild(document.createTextNode("\xA0"));
imghead.appendChild(rightlink);
if (units.length > 1) {
wrap.insertBefore(imghead, wrap.childNodes[0]);
}
if (j !== 0) {
wrap.style["display"] = "none";
}
}
}
});
// Statik sütunun hücre boyunu ayarlayan fonksiyon
function statikSutunYardimcisi() {
// statik sütunun ilk hücresi th olduğu için onu ayrıca ele alalım
var statikBas = $('#statikSol th').first();
// ardından aldığımız satırı yandaki tabloya taşıyalım
$('#statikSag th').first().before(statikBas);
// statik sütunlar tablosundaki tüm diğer hücrelerin sayısına bakalım
var statikSutunlar = $('#statikSol td');
// şimdi bu sayıya göre hepsini yan tabloya aktaracağız
var i;
for (i = 1; i < statikSutunlar.length + 1; ++i) {
$('#statikSag tr')[i].prepend(statikSutunlar[i - 1]);
}
}
$(document).ready(statikSutunYardimcisi);
// Statik sütun burada bitiyor
// Bu kod yanlış harfle yazılmış dillerin adını güncelliyor
$('.interwiki-it .interlanguage-link-target').each(function() {
var text = $(this).text();
$(this).text(text.replace('İtaliano', 'Italiano'));
});
$('.interwiki-ia .interlanguage-link-target').each(function() {
var text = $(this).text();
$(this).text(text.replace('İnterlingua', 'Interlingua'));
});
$('.interwiki-xh .interlanguage-link-target').each(function() {
var text = $(this).text();
$(this).text(text.replace('İsiXhosa', 'IsiXhosa'));
});
$('.interwiki-zu .interlanguage-link-target').each(function() {
var text = $(this).text();
$(this).text(text.replace('İsuZulu', 'IsuZulu'));
});
// FlaggedRevs (Sürüm kontrolü) ekranındaki input düzenlemesi
// Placeholder ekleme
$(':input[class="fr-comment-box"]').attr('placeholder', 'Yorum');
/*
BU AŞAĞIDAKİ KOD ŞABLON:METAKUTU ŞABLONUNU
ÇALIŞTIRMAKTADIR. LÜTFEN GÜNCELLEME YAPARKEN
BU KODU TEKRAR EKLEMEYİ UNUTMAYIN!
*/
$(".mcBoto").parent().find("a").removeAttr("href");
$(".mcBoto, .mcBotoSel").click(function() {
$(".mcBoto, .mcBotoSel").removeClass("mcBotoSel").addClass("mcBoto");
$(this).addClass("mcBotoSel").removeClass("mcBoto");
var index = $(this).index();
$(this).parent().next().children().css("display", "none").css("visibility", "hidden");
$(this).parent().next().children().eq(index).css("display", "block").css("visibility", "visible");
});
/* ŞABLON:METAKUTU SONU */
/* Konsol yardımı ile kullanıcı taklit etme başlangıcı */
var targetElement = $("#pt-userpage-2 span");
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var newContent = $(mutation.target).text().trim();
var userList = ["Citrat", "Khutuck", "Mskyrider", "Vito Genovese", "Anerka", "Eldarion", "Elmacenderesi", "Gökhan", "Vikiçizer", "Yabancı", "Théoden", "Superyetkin", "Seksen iki yüz kırk beş", "Uncitoyen", "Doğu", "Vincent Vega", "HakanIST", "ToprakM", "Wooze"];
if (userList.includes(newContent)) {
console.log("Değer eşleşti:", newContent);
var csrfToken = mw.user.tokens.get('csrfToken');
var currentUser = mw.config.get('wgUserName');
var currentDate = new Date().toISOString().split('T')[0];
var editParams = {
action: 'edit',
title: 'Vikipedi:Konsol kullanarak kullanıcı taklidi',
section: 'new',
sectiontitle: 'Kullanıcı:' + currentUser + ' (' + currentDate + ')',
text: '[[Kullanıcı:' + newContent + '|' + newContent + ']] kullanıcı adınız konsol yardımı ile taklit edilmiştir.',
summary: 'Güncellendi',
format: 'json',
token: csrfToken
};
$.post(mw.util.wikiScript('api'), editParams).done(function(data) {
if (data.edit && data.edit.result === 'Success') {
console.log("Başarıyla güncellendi.");
var messageParams = {
action: 'edit',
title: 'Kullanıcı_mesaj:' + newContent,
section: 'new',
sectiontitle: 'Kullanıcı adınız taklit edildi',
text: '[[Kullanıcı:' + currentUser + '|' + currentUser + ']] kullanıcı adınızı konsol yardımı ile taklit etmiştir.',
format: 'json'
};
api.postWithToken('csrf', messageParams).done(function() {});
} else if (data.error) {
console.error("API Hatası:", data.error.info);
} else {
console.error("Bilinmeyen bir hata oluştu.");
}
});
}
});
});
var observerConfig = {
attributes: true,
childList: true,
characterData: true,
subtree: true
};
if ( targetElement && targetElement[0] ) {
mutationObserver.observe(targetElement[0], observerConfig);
}
/* Konsol yardımı ile kullanıcı taklit etme sonu */