مستخدم:SADIQUI/common.js
الملف المصاحب .css لهذا المظهر موجود في مستخدم:SADIQUI/common.css. |
ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات ( ).
// 0. Γορ ατγς$$ $εε: $$ωικι/μτα/ςοπποη.η$
// 1. Γορ τηε Ιατε$τ υρδατε $εε ςοΙοτηοτε αρρ (ηοτ αηγ ωοπε)
/* #1/2 for thumbs */
mw.hook( 'wikipage.content' ).add( function() {
$( '.thumbinner' ).not( '.mp-thumb' ).each( function() {
$( this ).css( 'width', ( parseInt( $( this ).css( 'width' ) ) - 2 ) + 'px' );
} );
} );
/* #2/2 do not copy refs numbs */
$(document).ready(function () {
$('.reference, .mw-editsection').on('cut copy paste', function (e) {
e.preventDefault();
});
});
// 8. Search results Tool (Arabic)
( function ( mw, $ ) {
mw.loader.using( ['mediawiki.util'], function () {
$(function() {
if (document.title.indexOf("نتائج البحث عن") == -1) {
return;
}
var SRSisterSwitch;
var SRRedirectedSwitch;
var SRDetailSwitch;
var SRWikifySwitch;
var SRSortSwitch;
var elems0;
var elems1;
var elems2;
var SRSisterStatus = localStorage.getItem('SRSisterStatus');
var SRRedirectedStatus = localStorage.getItem('SRRedirectedStatus');
var SRDetailStatus = localStorage.getItem('SRDetailStatus');
var SRWikifyStatus = localStorage.getItem('SRWikifyStatus');
var SRSortStatus = localStorage.getItem('SRSortStatus');
TrueMatch();
elems0 = $('.mw-search-results li').detach().attr( "id", function( arr ) {
return arr;
});
$('.mw-search-results').append(elems0);
$( ".mw-search-result-heading" ).children( "a" ).addClass( "sr-a" );
var searchResultAElements = document.getElementsByClassName("sr-a");
var i;
for (i = 0; i < searchResultAElements.length; i++) {
searchResultAElements[i].outerHTML = searchResultAElements[i].outerHTML.replace(/(<a.*?(<\/a>))/g,'<span class=wikibrackets>* [[</span>$1<span class=wikibrackets>]]</span>');
}
SRWikify();
SRSort();
SRSister();
SRRedirected();
SRDetail();
SRFilter();
function TrueMatch() {
if (document.title.indexOf('intitle:"') != -1) {
var docTitle = document.title;
var regexIntitle = new RegExp('intitle:"(.+?)(")(.*)','i');
var intitle;
intitle = docTitle.replace(regexIntitle,"$1");
$('.mw-search-results').find('li').has( 'div > a:contains("' + intitle + '")' ).addClass('truematch');
$('.mw-search-results').find('li').not('.truematch').remove();
}
}
function SRWikify() {
if ( SRWikifyStatus === "on" ) {
SRWikifyOn();
} else {
SRWikifyOff();
}
}
function SRSort() {
if ( SRSortStatus === "on" ) {
SRSortOn();
} else {
SRSortOff();
}
}
function SRSister() {
if ( SRSisterStatus === "off" ) {
SRSisterOff();
} else {
SRSisterOn();
}
}
function SRRedirected() {
if ( SRRedirectedStatus === "off" ) {
SRRedirectedOff();
} else {
SRRedirectedOn();
}
}
function SRDetail() {
if ( SRDetailStatus === "off" ) {
SRDetailOff();
} else {
SRDetailOn();
}
}
function SRSisterOff() {
localStorage.setItem("SRSisterStatus", "off");
$('#mw-interwiki-results').hide();
if ( SRSisterSwitch ) {
SRSisterSwitch.parentNode.removeChild(SRSisterSwitch);
}
SRSisterSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR sisters \(turn on\)', 'tb-Sister', 'Show sister projects search results', '', '#tb-Sort' );
$( SRSisterSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRSisterOn();
} );
}
function SRSisterOn() {
localStorage.setItem("SRSisterStatus", "on");
$('#mw-interwiki-results').show();
if ( SRSisterSwitch ) {
SRSisterSwitch.parentNode.removeChild(SRSisterSwitch);
}
SRSisterSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR sisters \(turn off\)', 'tb-Sister', 'Hide sister projects search results', '', '#tb-Sort' );
$( SRSisterSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRSisterOff();
} );
}
function SRRedirectedOff() {
localStorage.setItem("SRRedirectedStatus", "off");
$("li").has(".searchalttitle").hide();
if ( SRRedirectedSwitch ) {
SRRedirectedSwitch.parentNode.removeChild(SRRedirectedSwitch);
}
SRRedirectedSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR redirecteds \(turn on\)', 'tb-Redirecteds', 'Show redirected entries and entries from matching categories', '', '#tb-Sister' );
$( SRRedirectedSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRRedirectedOn();
} );
}
function SRRedirectedOn() {
localStorage.setItem("SRRedirectedStatus", "on");
$("li").has(".searchalttitle").show();
if ( SRRedirectedSwitch ) {
SRRedirectedSwitch.parentNode.removeChild(SRRedirectedSwitch);
}
SRRedirectedSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR redirecteds \(turn off\)', 'tb-Redirecteds', 'Hide redirected entries and entries from matching categories', '', '#tb-Sister' );
$( SRRedirectedSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRRedirectedOff();
} );
}
function SRDetailOff() {
localStorage.setItem("SRDetailStatus", "off");
$('.searchresult').hide();
$('.mw-search-result-data').hide();
$( ".mw-search-results" ).find( 'li' ).css( 'display', 'inline' );
if ( SRRedirectedStatus === "off" ) {
$("li").has(".searchalttitle").hide();
} else {
$("li").has(".searchalttitle").show();
}
if ( SRDetailSwitch ) {
SRDetailSwitch.parentNode.removeChild(SRDetailSwitch);
}
SRDetailSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR details \(turn on\)', 'tb-Detail', 'Show the details', '', '#tb-Redirecteds' );
$( SRDetailSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRDetailOn();
} );
}
function SRDetailOn() {
localStorage.setItem("SRDetailStatus", "on");
$('.searchresult').show();
$('.mw-search-result-data').show();
$( ".mw-search-results" ).find( 'li' ).css( 'display', 'block' );
if ( SRRedirectedStatus === "off" ) {
$("li").has(".searchalttitle").hide();
} else {
$("li").has(".searchalttitle").show();
}
if ( SRDetailSwitch ) {
SRDetailSwitch.parentNode.removeChild(SRDetailSwitch);
}
SRDetailSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR details \(turn off\)', 'tb-Detail', 'Hide the details', '', '#tb-Redirecteds' );
$( SRDetailSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRDetailOff();
} );
}
function SRWikifyOff() {
localStorage.setItem("SRWikifyStatus", "off");
$('.wikibrackets').hide();
if ( SRWikifySwitch ) {
SRWikifySwitch.parentNode.removeChild(SRWikifySwitch);
}
SRWikifySwitch = mw.util.addPortletLink( 'p-tb', '', 'SR wikify \(turn on\)', 'tb-Wikify', 'Show wiki brackets around links for easy copy and paste', '', '#t-specialpages' );
$( SRWikifySwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRWikifyOn();
} );
}
function SRWikifyOn() {
localStorage.setItem("SRWikifyStatus", "on");
$( '.wikibrackets' ).show();
if ( SRWikifySwitch ) {
SRWikifySwitch.parentNode.removeChild(SRWikifySwitch);
}
SRWikifySwitch = mw.util.addPortletLink( 'p-tb', '', 'SR wikify \(turn off\)', 'tb-Wikify', 'Hide wiki brackets around links', '', '#t-specialpages' );
$( SRWikifySwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRWikifyOff();
} );
}
function SRSortOn() {
localStorage.setItem("SRSortStatus", "on");
elems1 = $('.mw-search-results li').detach().sort(function (a, b) {
return ($(a).text() < $(b).text() ? -1
: $(a).text() > $(b).text() ? 1 : 0);
});
$('.mw-search-results').append(elems1);
if ( SRSortSwitch ) {
SRSortSwitch.parentNode.removeChild(SRSortSwitch);
}
SRSortSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR sort \(turn off\)', 'tb-Sort', 'Show search results in original order', '', '#tb-Wikify' );
$( SRSortSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRSortOff();
} );
}
function SRSortOff() {
localStorage.setItem("SRSortStatus", "off");
elems2 = $('.mw-search-results li').detach().sort(function (a, b) {
return (parseInt(a.id) < parseInt(b.id) ? -1
: parseInt(a.id) > parseInt(b.id) ? 1 : 0);
});
$('.mw-search-results').append(elems2);
if ( SRSortSwitch ) {
SRSortSwitch.parentNode.removeChild(SRSortSwitch);
}
SRSortSwitch = mw.util.addPortletLink( 'p-tb', '', 'SR sort \(turn on\)', 'tb-Sort', 'Sort search results', '', '#tb-Wikify' );
$( SRSortSwitch ).click( function ( e ) {
e.preventDefault(); // prevents any default action -- we want only the following action to run:
SRSortOn();
} );
}
} );
} );
}( mediaWiki, jQuery ) );