User:Aiihuan/wikia.js

/* Imports */ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:ListFiles/code.js',    ] }); /* Image categorization custom edit buttons */ mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Usage heading", "tagOpen":"== Usage ==\n" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Userpage image", tagOpen: "{" + "{Userpageimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Thread image", tagOpen: "{" + "{Threadimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Template image", tagOpen: "{" + "{Templateimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Community image", tagOpen: "{" + "{Communityimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Help image", tagOpen: "{" + "{Helpimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Hub image", tagOpen: "{" + "{Hubimage}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Licensing heading", "tagOpen":"== Licensing ==\n" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Fandom screenshot", tagOpen: "{" + "{Fandom-screenshot}}" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Summary heading", "tagOpen":"== Summary ==\n" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "speedTip":"Staff image", tagOpen: "{" + "{StaffImage}}" }; /* Credits to fngplg */ if (wgCanonicalSpecialPageName === 'Newpages') { function sanitize (content) { var c = $(' ', {html: content}); c.find('script').remove; return c.html; }   function preview (href, $element) { var apiUri = new mw.Uri({path: '/api.php'}); apiUri.extend({action: 'parse', page: href, section: 0,           prop: 'images|text', format: 'json', disablepp: , redirects: }); $.getJSON(apiUri).done(function(data){           var content = sanitize(data.parse.text['*']);            $element.find('.comment').html(content);        }); }   function q  { var lis = $('#mw-content-text > ul li'); $.each(lis, function{           var $this = $(this);            var link = $this.find('.mw-newpages-pagename:first').attr('title');            preview(link, $this);        }); };   $(q); }