User:Atvelonis/global.js

//================================// //====Last Edited - Last Edited shows who edited last on the top of a page====// //================================//

importArticles({ type: 'script', articles: [ // ... 'u:dev:LastEdited/code.js', // ... ] });

/* Removing first half of hideous Fandom logo */

$('svg.wds-global-navigation__logo-image.wds-is-wds-company-logo-fandom').replaceWith('');

/** require(['jquery', 'wikia.ui.factory'], function ($, uiFactory) {	'use strict';	uiFactory.init('modal').then(function (uiModal) { var bioText = ''; $(function {            //Test page for masthead and link to discussions profile and check for double loads            if($('#discussion-bio').length === 0 && $('#UserProfileMasthead #discussionAllPostsByUser').attr('href')) {                var userId = $('#UserProfileMasthead #discussionAllPostsByUser').attr('href').split('/')[3];                //Fetch bio                $.ajax({ type: 'GET', url: 'https://services.wikia.com/user-attribute/user/' + userId + '/attr/bio', success: function(data) { bioText = data.value; //Create new masthead entry $('.UserProfileMasthead .details').append(' BIO ' + bioText.replace(/(?:\r\n|\r|\n)/g, ' ') + ''); //Add expand toggle button if overflow happens if($('#discussion-bio').prop('scrollHeight') > $('#discussion-bio').outerHeight) { $('#discussion-bio').after(' [Show more] '); // opening a content-size modal example $('#discussion-bio-toggle').click(function {                				var modalConfig = {                					type: 'default',                					vars: {                						id: 'discussionsbiomodal',                						size: 'content-size',                						content: ' ' + bioText.replace(/(?:\r\n|\r|\n)/g, ' ') + ' ',               						class: 'styleguide-example-content-size',                						title: 'Biography',                						closeText: 'Close',                						buttons: [                							{                								vars: {                									value: 'Close',                									classes: 'primary',                									data: [                										{                											key: 'event',                											value: 'close'                										}                									]                								}                							}                						]                					}                				};                				showModal(modalConfig);                			}); }                   }                });            }			/**			 * Shows a modal; unified function for different modals			 *			 * @param {Object} modalConfig - uiFactory modal config object			 * @param {Function} callback - optional; Callback after modal is initialized			 */			function showModal(modalConfig, callback) {				if (typeof callback !== 'function') {					callback = function (demoModal) {						demoModal.show;					};				}				uiModal.createComponent(modalConfig, callback);			}		}); }); });
 * @author: Flightmare (http://elderscrolls.wikia.com/wiki/User:Flightmare)
 * @version: 1.0
 * @license: CC-BY-SA 3.0
 * @description: Imports the discussions bio (app profile) into the masthead.

/* Global DiscussionsFeed */

importArticles({   type: 'script',    articles: [        'u:dev:DiscussionsFeed.js',    ] });