Me-command *OLD*

Gives a "/me" command

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name           Me-command *OLD*
// @namespace      http://www.kongregate.com/games/*
// @description     Gives a "/me" command
// @include        http://www.kongregate.com/games/*
// @version 0.0.1.20160330193305
// ==/UserScript==

// Rewritten by the awesome Ventero for compatibility with his scripts.

var loaded = false;

function init(){
	if(this.holodeck && this.ChatDialogue){
		loaded = true;
		var _holodeck = this.holodeck,
		styleColor = GM_getValue("kong_slashMeColor", "\#660099");
		GM_registerMenuCommand("Change \/me command text color", function(e) { 
			var color = prompt("Please enter the color code in the form \#HHHHHH (default \#660099)");
			if (z=color.match(/(\#[0-9a-fA-F]{6})/)){
				styleColor=z[1]
				sheet = document.styleSheets[1];
				for (var i=0;i<sheet.cssRules.length;i++){
					if(sheet.cssRules[i].selectorText == "#kong_game_ui .chat_message_window .slashMe"){
						sheet.cssRules[i].style.color = styleColor;
						window.setTimeout(function(){GM_setValue("kong_slashMeColor", styleColor);}, 0);
						alert("Changed color to " + styleColor);
					}
				}
			}else{alert("Invalid format!");};
			
		});

		this.ChatDialogue.prototype.oldInsertFunction1234 = this.ChatDialogue.prototype.insert;

		this.ChatDialogue.prototype.insert = function (content) {
			var l = content.indexOf('</span>:');
			var c = content.indexOf('"', content.indexOf('<p class="') + 10);
			var k = content.indexOf('<span', c);
			var u = content.indexOf('username="')+10;
			var un = content.lastIndexOf(content.substring(u, content.indexOf('"', u)), l);

			if (content.indexOf('\u200B')!=-1 && content.indexOf('\ufeff') != -1) {
			
				content = content.substring(0,c) + ' slashMe' + content.substring(c, k) + '* ' + content.substring(k, un) + 

'</span>' + content.substring(l+9);

			} else if(content.indexOf('\u200B')!=-1){

				content = content.substring(0, c) + ' slashMe' + content.substring(c, k) + '* ' + content.substring(k, l) + 

'</span>' + content.substring(l+8);

			} else if (content.indexOf('\ufeff') != -1) {
				
				content = content.substring(0, c) + ' slashMe' + content.substring(c, un) + '</span>' + content.substring

(l+9);
			}

			this.oldInsertFunction1234(content);
		}
		
		this.holodeck.addChatCommand("me", function(l,n) {
			l.chatWindow().activeRoom().sendRoomMessage('\u200B' + n.substring(n.indexOf('\/me ') + 4));
			return false;
		});
		this.holodeck.addChatCommand("nouser", function(l,n) {
			l.chatWindow().activeRoom().sendRoomMessage('\ufeff' + n.substring(n.indexOf('\/nouser ') + 8));
			return false;
		});
		
		sheet = document.styleSheets[1];
		sheet.insertRule('#kong_game_ui .chat_message_window .slashMe { color:'+styleColor+';}',sheet.cssRules.length);
	} else {
		setTimeout(init, 1000);
	}
};

if (!loaded) {
  setTimeout(init, 1500);
};