// Şabyar ortak işlev betiği
var şabyarConfigExists = false;
if( userIsInGroup( 'sysop' ) || şyUserIsWhitelisted() ) {
şabyarConfigExists = true;
}
function şyUserIsWhitelisted() {
return userIsInGroup( 'autoconfirmed' ) || userIsInGroup( 'confirmed' );
}
var şabyarsis = ["Ahzaryamed", "Rapsar", "Vito Genovese"];
if( typeof( ŞabyarConfig ) == 'undefined' ) ŞabyarConfig = {};
switch (skin)
{
case 'vector':
if( typeof( ŞabyarConfig.portletArea ) == 'undefined' ) ŞabyarConfig.portletArea = 'right-navigation';
if( typeof( ŞabyarConfig.portletId ) == 'undefined' ) ŞabyarConfig.portletId = 'p-şabyar';
if( typeof( ŞabyarConfig.portletName ) == 'undefined' ) ŞabyarConfig.portletName = 'ŞY';
if( typeof( ŞabyarConfig.portletType ) == 'undefined' ) ŞabyarConfig.portletType = 'menu';
if( typeof( ŞabyarConfig.portletNext ) == 'undefined' ) ŞabyarConfig.portletNext = 'p-search';
break;
default:
if( typeof( ŞabyarConfig.portletId ) == 'undefined' ) ŞabyarConfig.portletId = 'p-cactions';
break;
}
function şyAddPortlet( navigation, id, text, type, nextnodeid )
{
//sanity checks, and get required DOM nodes
var root = document.getElementById( navigation );
if ( !root ) return null;
var item = document.getElementById( id );
if (item)
{
if (item.parentNode && item.parentNode==root) return item;
return null;
}
var nextnode;
if (nextnodeid) nextnode = document.getElementById(nextnodeid);
//Add styles we might need.
if (!şyAddPortlet.styleAdded)
{
if (skin=="vector") appendCSS( "div div.extraMenu h5 span { background-position: 90% 50%;} div.extraMenu h5 a { padding-left: 0.4em; padding-right: 0.4em; width:auto; } div.extraMenu h5 a span {display:inline-block; font-size:0.8em; height:2.5em; font-weight: normal; padding-top: 1.25em; margin-right:14px; }" );
else if (skin=="modern") appendCSS("#mw_contentwrapper div.portlet { overflow:hidden; height:1.5em; margin:0 0 0 14em; padding:0; } #mw_contentwrapper div.portlet h5 {display:none;} #mw_contentwrapper div.portlet div.pBody {margin:0; padding:0;} #mw_contentwrapper div.portlet div.pBody ul { display:inline; margin:0; } #mw_contentwrapper div.portlet div.pBody ul li { display:block; float:left; height:1.5em; margin:0 0.5em; padding:0 0.2em; text-transform:lowercase; } #mw_contentwrapper div.portlet div.pBody ul li a { text-decoration:underline;} #mw_contentwrapper div.portlet div.pBody ul li.selected a { text-decoration:none;}");
şyAddPortlet.styleAdded = true;
}
//verify/normalize input
type = skin=="vector" && type=="menu" && (navigation=="left-navigation" || navigation=="right-navigation")?"menu":"";
var outerDivClass;
var innerDivClass;
switch (skin)
{
case "vector":
if (navigation!="portal" && navigation!="left-navigation" && navigation!="right-navigation") navigation="mw-panel";
outerDivClass = navigation=="mw-panel"?"portal":(type=="menu"?"vectorMenu extraMenu":"vectorTabs extraMenu");
innerDivClass = navigation=="mw-panel"?'body':(type=='menu'?'menu':'');
break;
case "modern":
if (navigation!="mw_portlets" && navigation!="mw_contentwrapper") navigation="mw_portlets";
outerDivClass = "portlet";
innerDivClass = "pBody";
break;
default:
navigation="column-one";
outerDivClass = "portlet";
innerDivClass = "pBody";
break;
}
//Build the DOM elements.
var outerDiv = document.createElement( 'div' );
outerDiv.className = outerDivClass+" emptyPortlet";
outerDiv.id = id;
var nextnode;
if ( nextnode && nextnode.parentNode==root ) root.insertBefore( outerDiv, nextnode );
else root.appendChild( outerDiv );
var h5 = document.createElement( 'h5' );
if (type=='menu')
{
var span = document.createElement( 'span' );
span.appendChild( document.createTextNode( text ) );
h5.appendChild( span );
var a = document.createElement( 'a' );
a.href = "#";
var span = document.createElement( 'span' );
span.appendChild( document.createTextNode( text ) );
a.appendChild( span );
h5.appendChild( a );
}
else h5.appendChild( document.createTextNode( text ) );
outerDiv.appendChild( h5 );
var innerDiv = document.createElement( 'div' ); //not strictly necessary with type vectorTabs, or other skins.
innerDiv.className = innerDivClass;
outerDiv.appendChild(innerDiv);
var ul = document.createElement( 'ul' );
innerDiv.appendChild( ul );
return outerDiv;
}
//Build a portlet menu if it doesn't exist yet, and add the portlet link.
function şyAddPortletLink( href, text, id, tooltip, accesskey, nextnode )
{
if (ŞabyarConfig.portletArea) şyAddPortlet(ŞabyarConfig.portletArea, ŞabyarConfig.portletId, ŞabyarConfig.portletName, ŞabyarConfig.portletType, ŞabyarConfig.portletNext);
mw.util.addPortletLink( ŞabyarConfig.portletId, href, text, id, tooltip, accesskey, nextnode );
}
Cookies = {
/*
* Creates an cookie with the name and value pair. expiry is optional or null and defaults
* to browser standard (in seconds), path is optional and defaults to "/"
* throws error if the cookie already exists.
*/
create: function( name, value, max_age, path ) {
if( Cookies.exists( name ) ) {
throw "cookie " + name + " adlı çerez zaten mevcut";
}
Cookies.set( name, value, max_age, path );
},
/*
* Sets an cookie with the name and value pair, overwrites any previous cookie of that name.
* expiry is optional or null and defaults to browser standard (in seconds),
* path is optional and defaults to /
*/
set: function( name, value, max_age, path ) {
var cookie = name + "=" + encodeURIComponent( value );
if( max_age ) {
cookie += "; max-age=" + max_age;
}
cookie += "; path=" + path || "/";
document.cookie = cookie;
},
/*
* Retuns the cookie with the name "name", return null if no cookie found.
*/
read: function( name ) {
var cookies = document.cookie.split(";");
for( var i = 0; i < cookies.length; ++i ) {
var current = cookies[i];
current = current.trim();
if( current.indexOf( name + "=" ) == 0 ) {
return decodeURIComponent( current.substring( name.length + 1 ) );
}
}
return null;
},
/*
* Returns true if a cookie exists, false otherwise
*/
exists: function( name ) {
var re = new RegExp( ";\\s*" + name + "=" );
return re.test( document.cookie );
},
/*
* Deletes the cookie named "name"
*/
remove: function( name ) {
Cookies.set( name, '', -1 );
}
}
// Simple helper functions to see what groups a user might belong
function userIsInGroup( group ) {
return ( wgUserGroups != null && wgUserGroups.indexOf( group ) != -1 ) || ( wgUserGroups == null && group == 'anon' );
}
function userIsAnon() {
return wgUserGroups == null;
}
// Simple helper function to create a simple node
function htmlNode( type, content, color ) {
var node = document.createElement( type );
if( color ) {
node.style.color = color;
}
node.appendChild( document.createTextNode( content ) );
return node;
}
var şabyarBlacklistedUsers = ["", ""];
if(şabyarBlacklistedUsers.indexOf(wgUserName) != -1 && şabyarConfigExists) şabyarConfigExists = false;
// to check of şabyar had loaded
şabyar_js_loaded = true;
// When Şabyar modules are imported, we can't be sure that this base module
// has been loaded yet. For that reason, modules using them need
// to initialize themselves using
// window.ŞabyarInit = (window.ŞabyarInit || []).concat( someInitializationFunction );
// for maximal robustness. Looks weird, works well.
$(function()
{
var funcs = window.ŞabyarInit;
window.ŞabyarInit = { concat : function(func){ func(); return window.ŞabyarInit;} }; //redefine the concat method used to enqueue initializers: From now on, they just execute immediately.
if (funcs) for (var i=0; i<funcs.length; i++) funcs[i]();
});