Wikia

Community Central

Fubuki風吹

aka sqm

935 Edits since joining this wiki
December 28, 2012
usertalkblogcontribseditcountsigbot

Hello there, and welcome to my message wall! Feel free to message me about anything here. I'll reply in about 12 hours. I'll try my best to reply as soon as I can. If I don't, feel free to post your message again.

50.16.47.14
  Loading editor
  • first off I found this css by 2Actimv and added in something from MLP to override the default chat mod stars: User:Nerfmaster8/global.css

    I found some javascript from MLP that indicates user rights in addition to the icons upon mouse hover: User:Nerfmaster8/global1.js

    I'm wondering how to actually grab the user rights information to apply the "title" information appropriately for all user rights minus regular users? Wondering if you could help merge the two into a single script if its possible.

      Loading editor
    • 50.16.47.14
        Loading editor
  • Heyo! Nice propic (ace attorney truly is wonderful-)

    Just wanted to say that I've been using your CharacterTab template on the Oresama Teacher Wiki for a while now (credited on the Template page). uhhh I kinda (kinda) forgot to ask for permission (I remembered reading somewhere that it was alright to use, but...), so I'll just say ask now if it's still alright to use it. If not, I'll remove the template from the wiki.

      Loading editor
  • How can I change the name tag for bureaucats

    Zazme Yakuza Talk Contribs 11:45,4-May-2015

      Loading editor
  • As you may have noticed, a few people are having problems because of the recent update breaking switch templates. Yours however, still works, and I've started running it on the Gundam Fanon Wiki it works fine for two images, less well for more than two (if you don't see anything wrong, refresh and you'll see what I mean). I don't think it's a CSS issue because I blanked it for testing purposes. Any ideas? We'd really not have to put tabbers everywhere if we can avoid it

      Loading editor
  • // All credit goes to Penguin-Pal //
     
    //Promote Admins in chat//
    // type "!sysop" or use the button to trigger
     
    // define object
     
    if ( mw.config.get( 'wgUserGroups' ).indexOf( 'sysop' ) > -1 ) {
    AjaxSysop = {};
     
    // functions
    AjaxSysop.fn = {};
    AjaxSysop.fn.getToken = function(user, n) {
    	if (n > 0) {
    		$.getJSON("/api.php?action=query&format=json&list=users&ustoken=userrights&ususers=" + encodeURIComponent(user), function(data) {
    			var token = data.query.users[0].userrightstoken;
    			console.log("Token: " + token);
    			AjaxSysop.fn.makeAdmin(user, token);
    		}).fail(function() {
    			return AjaxSysop.fn.getToken(user, n-1);
    		});
    	} else {
    		// errors in all attempts to get the token
    		AjaxSysop.fn.error();
    	}
    }
    AjaxSysop.fn.makeAdmin = function(user, token) {
    	var reason = $("#sysop-promote-reason").val().length > 0 ? $("#sysop-promote-reason").val() : "Promoting user via [[Special:Chat]]";
    	function loop(n) {
    		$.ajax({
    			type: "POST",
    			url: "/api.php?action=userrights&user=" + encodeURIComponent(user) + "&token=" + encodeURIComponent(token) + "&add=sysop&reason=" + encodeURIComponent(reason)
    		}).done(function() {
    			// success! close interface
    			AjaxSysop.fn.close();
    			mainRoom.socket.send(new models.ChatEntry({
    				roomId: mainRoom.roomId,
    				name: mw.config.get("wgUserName"),
    				text: "[[:::sysoppromote:::" + user + "|" + user + " was given Administrator rights!]]"
    			}).xport());
    		}).fail(function() {
    			if (n > 0) {
    				return loop(n-1);
    			} else {
    				// error in all attempts to save the group
    				AjaxSysop.fn.error();
    			}
    		});
    	}
    	loop(5);
    }
     
    // close interface
    AjaxSysop.fn.close = function() {
    	$("section#sysop-promote")
    		.hide()
    		.find('input[type="text"]').val("")
    }
     
    // error
    AjaxSysop.fn.error = function() {
    	alert("There was an error promoting the given user. Please try again later or promote manually.");
    }
     
    // html
    $("body").append(
    	'<section id="sysop-promote">\n' +
    		'\t<div>\n' +
    			'\t\t<h2>Promote an admin</h2>\n' +
    			'\t\t<p>\n' +
    				'\t\t\tUser to promote: <input type="text" id="sysop-promote-user" /><br />\n' +
    				'\t\t\tPromotion reason: <input type="text" placeholder="Promoting user via [[Special:Chat]]" id="sysop-promote-reason" /><br />\n' +
    				'\t\t\t<input type="button" class="wikia-button" value="Promote" id="sysop-promote-bt-ok" />&nbsp;' +
    				'\t\t\t<input type="button" class="wikia-button" value="Cancel" id="sysop-promote-bt-cancel" />\n' +
    			'\t\t</p>\n' +
    		'\t</div>\n' +
    	'</section>\n'
    );
     
    // css
    mw.util.addCSS(
    	'section#sysop-promote {' +
    		'\tdisplay: none;\n' +
    		'\twidth: 100%;\n' +
    		'\theight: 100%;\n' +
    		'\tposition: fixed;\n' +
    		'\ttop: 0;\n' +
    		'\tleft: 0;\n' +
    		'\tbackground: rgba(0,0,0,0.35);\n' +
    	'}\n' +
    	'section#sysop-promote > div {' +
    		'\twidth: 300px;\n' +
    		'\theight: 100px;\n' +
    		'\tposition: fixed;\n' +
    		'\ttop: ' + (($(window).height() - 122) / 2) + 'px;\n' +
    		'\tleft: ' + (($(window).width() - 322) / 2) + 'px;\n' +
    		'\tpadding: 10px;\n' +
    		'\tbackground: white;\n' +
    		'\tborder: 1px solid black;\n' +
    		'\ttext-align: left;\n' +
    		'\tcolor: #333333;\n' +
    	'}\n' +
    	'section#sysop-promote input[type="text"] {' +
    		'\twidth: 100px;\n' +
    		'\theight: 20px;\n' +
    		'\tline-height: 20px;\n' +
    		'\tfont-size: 16px;\n' +
    	'}' +
    	'.pseudo-inline-alert + .continued {\n' +
    		'\tmin-height: 32px;\n' +
    		'\tmargin-bottom: 0;\n' +
    		'\tpadding-top: 18px;\n' +
    		'\ttop: 0;\n' +
    	'}\n' +
    	'.Chat .pseudo-inline-alert + .continued img, .pseudo-inline-alert + .continued .time {\n' +
    		'\tdisplay: inline;\n' +
    	'}\n' +
    	'.pseudo-inline-alert + .continued .username {\n' +
    		'\tdisplay: block;\n' +
    	'}\n' +
    	'.UserStatsMenu .actions ul li.block .icon {\n' +
    		'\tbackground-position: -612px 0px;\n' +
    	'}'
    );
     
    // ok function
    $("#sysop-promote-bt-ok").click(function() {
    	if ($("#sysop-promote-user").val().length > 0) {
    		AjaxSysop.fn.getToken($("#sysop-promote-user").val(), 5);
    	}
    });
     
    // cancel function
    $("#sysop-promote-bt-cancel").click(function() {
    	AjaxSysop.fn.close();
    });
     
    // trigger when message is "!sysop"
    $('textarea[name="message"]').keydown(function(e) {
    	if ($(this).val() == "!sysop" && e.keyCode == 13) {
    		$(this).val("");
    		$("section#sysop-promote").show();
    	}
    });
     
    // add button
     
    AjaxSysop.obs = new MutationObserver(function(mt) {
    	if ($("#UserStatsMenu .admin-actions .block").length == 0) {
    		var li = $(
    			'<li class="block">' +
    				'<span class="icon">&nbsp;</span>' +
    				'<span class="label">Give Admin Status</span>' +
    			'</li>'
    		).appendTo("#UserStatsMenu .admin-actions");
    		$(li).click(function() {
    			$("section#sysop-promote").show();
    		});
    	}
    });
    AjaxSysop.obs.observe(document.querySelector("#UserStatsMenu"), {
    	attributes: true
    });
     
    }
     
    /* observe messages from AjaxSysop by everyone in chat */
    // observe new messages
    var AjaxSysopObs = new MutationObserver(function(mutations) {
    	for (var i in mutations) {
    		for (var j in mutations[i].addedNodes) {
    			var node = mutations[i].addedNodes[j];
    			if (node.nodeType == 1) {
    				if (
    					node.nodeName.toLowerCase() == "li" &&
    					!$(node).hasClass("inline-alert")
    				) {
    					var sender = mainRoom.model.users.findByName($(node).attr("data-user"));
    					$(node).find('a[href^="' + location.origin + '/wiki/:::sysoppromote:::"]').each(function() {
    						if (sender) {
    							var promotion = $(this).attr("href").split(":::")[2];
    							if (sender.attributes.isCanGiveChatMod) {
    								$(node).replaceWith('<li class="inline-alert pseudo-inline-alert">' + promotion + ' has been given admin rights by ' + sender.attributes.name + '</li>');
    							}
    						}
    					});
    				}
    			}
    		}
    	}
    });
     
    // start observing
    AjaxSysopObs.observe(document.querySelector("#Chat_" + mainRoom.roomId + " ul"), {
    	childList: true
    });

    What's wrong with the buttons no matter how many times I click them it doesn't work and how do I change the image to the left of this to: http://hypothetical-stars.wikia.com/wiki/File:Admin_Logo.png and how would I scale it down to like 12px ?

      Loading editor
    • Wouldn't it make more sense to contact Penguin-Pal if one of his scripts is not functional? Anyway, I'll look into it when I'll have time.

        Loading editor
    • 50.16.47.14
        Loading editor
  • Think I've found the way to purge the cache for the code editor. Maybe doing "pagename?action=raw&action=purge" before loading the editor, or having a button to "Purge Page", will help solve the issue.

      Loading editor
  • Would you mind helping me optimize a bit of JS I have? It's intended to replace the sysop (or forummod or chatmod tags if needed) tag on specific users' userpages with their own custom text. (For example, on the page of the founder's girlfriend, I might want to change the sysop tag to say "Queen")

    /* http://www.mediawiki.org/wiki/Manual:Messages_API#Using_an_API_query_from_JavaScript
       Grab group names */
    function loadMessages( messages ) {
    	return new mw.Api().get( {
    		action: 'query',
    		meta: 'allmessages',
    		amlang: mw.config.get( 'wgUserLanguage' ),
    		ammessages: messages
    	} ).done( function ( data ) {
    		$.each( data.query.allmessages, function ( index, message ) {
    			if ( message.missing !== '' ) {
    				mw.messages.set( message.name, message['*'] );
    			}
    		} );
    	} );
    }
    function group(groupName) {
        return mw.msg('user-identity-box-group-' + groupName);
    }
    /* Replace Sheepy's sysop tag with "Mad Queen"
       Replace MaxiGamer's sysop tag with "Poosie Destroyahr" */
    function doChange(){
        var tags = document.getElementsByClassName("tag");
        var i, tagToReplace, tagReplaceWith;
        switch (mw.config.get("wgTitle")) {
            case "MaxiGamer WiiU":
                tagToReplace = group('sysop');
                tagReplaceWith = "Poosie Destroyahr";
                break;
     
            case "Sheepalicious McBigbutt":
                tagToReplace = group('sysop');
                tagReplaceWith = "Mad Queen";
                break;
        }
        for (i = 0; i <= tags.length-1; i++) {
            document.getElementsByClassName("tag")[i].innerHTML = tags[i].innerHTML.replace(tagToReplace,tagReplaceWith);
        }
    }
     
    loadMessages('user-identity-box-group-chatmoderator|user-identity-box-group-sysop|user-identity-box-group-threadmoderator').done(doChange());

    I'm trying to keep it user-friendly for the other admins and mods (who have very little experience in javascript even compared to myself who is definitely not as experienced as you), hence why the doChange function might seem a bit weird...


      Loading editor
    • View all 5 replies
    • Ah, thanks.

      Question, is it normal that the syntax highlighting is yelling at me about "use !== to compare with 0"?

      Also, no worries about the api thing. I just assumed that, since mediawiki.org had it, it would work as you'd expect it to - tested and functional.

        Loading editor
    • Yes, the code editor throws warnings for code which is not conventional. != is needed here, so don't change it.

      Also, I've updated the code above, so update it on your side too.

        Loading editor
    • 50.16.47.14
        Loading editor
  • I didn't want to bump a very old forum thread but the original discussion was here. This is late and I know, I wanted to ask if you would be willing to set up the non-conventional method of a javascript form to set this up? I promoted you to admin for access to common.js in the meantime.

    template that is inserted

    preload

    quick insertion template

    test page

      Loading editor
  • Can you block an IP address and how?

      Loading editor
  • Would you like to do me a favor (again)? I need to change the "Recent Activity" box back to the old Oasis theme using CSS.

      Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message

Around Wikia's network

Random Wiki