MediaWiki:Wikia.js: Difference between revisions

From The Sims Wiki, a collaborative database for The Sims series
Jump to navigation Jump to search
Content added Content deleted
imported>K6ka
mNo edit summary
imported>CzechOut
(Google Play Award. Please see the Admin noticeboard for more info.)
Line 78: Line 78:
}
}
}
}

/* ===================
Google Play Award
Right rail module
This code is temporary, and will only be active
until early December 2018.
Based on [[w:c:dev:AdoptMe.js]]
Are you an admin curious about what this is?
Please refer to your message wall or user talk page.
You'll find a message there from a FANDOM staff
member left in the first week of November 2018.
=================== */

var rightRailModules = {
config: {
loadOnNamespaces: [0],
locales: {
image: {
"en": "//images.wikia.com/czech-prey-out/images/b/b9/Sims.jpg"
},
altText: {
"en": "Vote now!"
},
url: {
"en": "https://play.google.com/store/apps/uservoting/Games%20US%20-%20Best%20Of%20User%20Voting%202018%20Voting%20Page%20?id=mc_games_us_bestofuservoting2018_uv_page"
}
}
},
checkRail: 0,
adoptImage: "",
adoptAltText: "",
adoptUrl: "",
localizeModules: function() {
var contentLanguage = wgContentLanguage,
localizedAdoptImage = typeof this.config.locales.image[contentLanguage] !== "undefined" ? this.config.locales.image[contentLanguage] : this.config.locales.image["en"];
localizedAltText = typeof this.config.locales.altText[contentLanguage] !== "undefined" ? this.config.locales.altText[contentLanguage] : this.config.locales.altText["en"];
localizedUrl = typeof this.config.locales.url[contentLanguage] !== "undefined" ? this.config.locales.url[contentLanguage] : this.config.locales.url["en"];
this.adoptImage = localizedAdoptImage;
this.adoptAltText = localizedAltText;
this.adoptUrl = localizedUrl;
},
addModules: function() {
var railHasLoaded = $("#WikiaRail .rail-module").length > 0;
if (railHasLoaded) {
clearInterval(this.checkRail);
this.addCTABanner();
}
},
addCTABanner: function() {
var addBefore = $('#wikia-recent-activity'),
bannerHTML = '<div class="cta-banner" style="margin: 15px auto; text-align:center;"><a href="' + this.adoptUrl + '"><img alt="' + this.adoptAltText + '" src="' + this.adoptImage + '"></a></div>';
addBefore.before(bannerHTML);
},
init: function() {
var thisObject = this;
if (($.inArray(mw.config.get('wgNamespaceNumber'), this.config.loadOnNamespaces) > -1) && !mw.config.get('wgIsMainPage')) {
this.localizeModules();
this.checkRail = setInterval(function() { thisObject.addModules(); }, 750);
}
}
}
$(function() {
rightRailModules.init();
});


/* ===================
Google Play Award
end
=================== */

//
//

Revision as of 23:00, 11 November 2018

// 07:34, June 16, 2017 (UTC)

/* Quick image license - contains the most commonly used licensing criteria */
if (wgUserGroups.indexOf('autoconfirmed') != -1) {
function QLicenseUI() {
	var options = {
                ' ': 'Select a license',
		'== Licensing ==\n{{Copyright by EA|fanon}}': 'Fanon image',
		'== Licensing ==\n{{Copyright by EA|sim1}}': 'Sim from TS1',
                '== Licensing ==\n{{Copyright by EA|ss1}}': 'Screenshot from TS1',
                '== Licensing ==\n{{Copyright by EA|lot1}}': 'Lot from TS1',
                '== Licensing ==\n{{Copyright by EA|sim2}}': 'Sim from TS2',
                '== Licensing ==\n{{Copyright by EA|ss2}}': 'Screenshot from TS2',
                '== Licensing ==\n{{Copyright by EA|lot2}}': 'Lot from TS2',
		'== Licensing ==\n{{Copyright by EA|sim3}}': 'Sim from TS3',
                '== Licensing ==\n{{Copyright by EA|ss3}}': 'Screenshot from TS3',
                '== Licensing ==\n{{Copyright by EA|lot3}}': 'Lot from TS3',
                '== Licensing ==\n{{Copyright by EA|sim4}}': 'Sim from TS4',
                '== Licensing ==\n{{Copyright by EA|ss4}}': 'Screenshot from TS4',
                '== Licensing ==\n{{Copyright by EA|lot4}}': 'Lot from TS4',
                '== Licensing ==\n{{Copyright by EA|simls}}': 'Sim from Life Stories',
                '== Licensing ==\n{{Copyright by EA|lotls}}': 'Lot from Life Stories',
                '== Licensing ==\n{{Copyright by EA|ssls}}': 'Screenshot from Life Stories',
                '== Licensing ==\n{{Copyright by EA|simps}}': 'Sim from Pet Stories',
                '== Licensing ==\n{{Copyright by EA|lotps}}': 'Lot from Pet Stories',
                '== Licensing ==\n{{Copyright by EA|ssps}}': 'Screenshot from Pet Stories',
                '== Licensing ==\n{{Copyright by EA|lotcs}}': 'Lot from Castaway Stories',
                '== Licensing ==\n{{Copyright by EA|sscs}}': 'Screenshot from Castaway Stories',
                '== Licensing ==\n{{Copyright by EA|simcon}}': 'Sim from a console game',
                '== Licensing ==\n{{Copyright by EA|sscon}}': 'Screenshot from a console game',
                '== Licensing ==\n{{Copyright by EA|obj}}': 'An object',
                '== Licensing ==\n{{Copyright by EA|pet}}': 'A pet',
                '== Licensing ==\n{{Copyright by EA|box}}': 'Box art',
                '== Licensing ==\n{{Copyright by EA|obj}}': 'An object',
                '== Licensing ==\n{{Copyright by EA|mem}}': 'A memory',
                '== Licensing ==\n{{Copyright by EA|mood}}': 'A moodlet',
                '== Licensing ==\n{{Copyright by EA|moodnf}}': 'A moodlet with no frame',
                '== Licensing ==\n{{Copyright by EA|trait}}': 'A trait',
                '== Licensing ==\n{{Copyright by EA|zodiac}}': 'A zodiac sign',
                '== Licensing ==\n{{Copyright by EA|logo}}': 'A game logo or icon',
                '== Licensing ==\n{{Copyright by EA|waf}}': 'A want or fear',
                '== Licensing ==\n{{Copyright by EA|interface}}': 'Something from the game interface',
                '== Licensing ==\n{{Copyright by EA|render}}': 'A game render',
                '== Licensing ==\n{{Copyright by EA|promo}}': 'A promotional image',
                '== Licensing ==\n{{Copyright by EA}}': 'Something else from The Sims series/other EA-copyrighted image',
                '== Licensing ==\n{{Copyrighted by Wikia}}': 'Something part of the Wikia interface',
		'== Licensing ==\n{{Fairuse}}': 'Fair use',
                '== Licensing ==\n{{cc-by-sa-3.0}}': 'This is licensed under Creative Commons Attribution 3.0 (free license)',
                '== Licensing ==\n{{GFDL}}': 'This is licensed under GFDL (free license)',
                '== Licensing ==\n{{PD}}': 'Public domain',
                '== Licensing ==\n{{No license}}': 'License unknown'
		};
	var optstr = '';
	for (var i in options ) {
		if ( options.hasOwnProperty( i ) ) {
			optstr += '<option value="' + i + '" style="text-align:left;padding-bottom:10px;">' + options[i] + '</option>';
		}
	}
 
	var html = '<p style="text-align:left;"><select id="QLicenseSelect">' + optstr + '</select>&nbsp;<a class="wikia-button" style="margin:0 1em; cursor:pointer;" id="aSubmit">Add license</a>';
	if($('#LicensedFile').length || $('#Licensing').length) {
		html += '&nbsp;<span style="color:red; font-weight:bold; text-align:left;">This file is licensed.</span></p>';
	} else {
		html += '&nbsp;<span style="color:green; font-weight:bold; text-align:left;">This file is not licensed.</span></p>';
	}
	$(html).insertBefore('#WikiaMainContent');
	$('#aSubmit').click( function(event) {
		this.innerHTML = '<img src="https://images.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" />';
		$.post("/api.php", {action: "edit", title: mw.config.get("wgPageName"), token: mw.user.tokens.values.editToken, bot: true, appendtext: $("#QLicenseSelect").val(), summary: "Licensing image."}, function (result) {
			window.location = wgServer + '/index.php?title=' + mw.config.get("wgPageName") + '&action=purge';
		});
	});
}
 
if (mw.config.get('wgNamespaceIds').file === mw.config.get('wgNamespaceNumber') && mw.config.get('wgAction') === 'view' && !window.QLicenseLoaded) {
    window.QLicenseLoaded = true;
    addOnloadHook(QLicenseUI);
}
}

/* =================== 
   Google Play Award
   Right rail module
   
   This code is temporary, and will only be active
   until early December 2018.
   
   Based on [[w:c:dev:AdoptMe.js]]
   
   Are you an admin curious about what this is?
   Please refer to your message wall or user talk page.
   You'll find a message there from a FANDOM staff
   member left in the first week of November 2018.
   =================== */

var rightRailModules = {
	config: {
		loadOnNamespaces: [0],
		locales: {
			image: {
				"en": "//images.wikia.com/czech-prey-out/images/b/b9/Sims.jpg"
			},
			altText: {
				"en": "Vote now!"
			},
			url: {
				"en": "https://play.google.com/store/apps/uservoting/Games%20US%20-%20Best%20Of%20User%20Voting%202018%20Voting%20Page%20?id=mc_games_us_bestofuservoting2018_uv_page"
			}
		}
	},
 
	checkRail: 0,
	
	adoptImage: "",
	
	adoptAltText: "",
	
	adoptUrl: "",
	
	localizeModules: function() {
		var	contentLanguage = wgContentLanguage,
			localizedAdoptImage = typeof this.config.locales.image[contentLanguage] !== "undefined" ? this.config.locales.image[contentLanguage] : this.config.locales.image["en"];
			localizedAltText = typeof this.config.locales.altText[contentLanguage] !== "undefined" ? this.config.locales.altText[contentLanguage] : this.config.locales.altText["en"];
			localizedUrl = typeof this.config.locales.url[contentLanguage] !== "undefined" ? this.config.locales.url[contentLanguage] : this.config.locales.url["en"];
			
		this.adoptImage = localizedAdoptImage;
		this.adoptAltText = localizedAltText;
		this.adoptUrl = localizedUrl;
	},
 
	addModules: function() {
		var railHasLoaded = $("#WikiaRail .rail-module").length > 0;
		if (railHasLoaded) {
			clearInterval(this.checkRail);
			this.addCTABanner();
		}		
	},
 
	addCTABanner: function() {
		var	addBefore = $('#wikia-recent-activity'), 
			bannerHTML = '<div class="cta-banner" style="margin: 15px auto; text-align:center;"><a href="' + this.adoptUrl + '"><img alt="' + this.adoptAltText + '" src="' + this.adoptImage + '"></a></div>';
		addBefore.before(bannerHTML);
	},
 
	init: function() {
		var thisObject = this;
		if (($.inArray(mw.config.get('wgNamespaceNumber'), this.config.loadOnNamespaces) > -1) && !mw.config.get('wgIsMainPage')) {
			this.localizeModules();
			this.checkRail = setInterval(function() { thisObject.addModules(); }, 750);
		}		
	}
}
 
$(function() {
	rightRailModules.init();
});


/* =================== 
   Google Play Award
   end
   =================== */

//