Beispiel #1
0
	UIComponent.prototype.parseHTML = function parseHTML()
	{
		var $node = jQuery(this);
		var background = $node.data('background');
		var preload = $node.data('preload');
		var hover = $node.data('hover');
		var down = $node.data('down');
		var msgId = $node.data('text');

		var preloads, i, count;

		var bg_uri = null;
		var hover_uri = null;

		// text
		if (msgId) {
			$node.text(DB.getMessage(msgId, ''));
		}

		// Default background
		if (background) {
			Client.loadFile(DB.INTERFACE_PATH + background, function (dataURI)
			{
				bg_uri = dataURI;
				$node.css('backgroundImage', 'url(' + bg_uri + ')');
			});
		}

		// On mouse over
		if (hover) {
			Client.loadFile(DB.INTERFACE_PATH + hover, function (dataURI)
			{
				hover_uri = dataURI;
				$node.mouseover(function () { this.style.backgroundImage = 'url(' + hover_uri + ')'; });
				$node.mouseout(function () { this.style.backgroundImage = 'url(' + bg_uri + ')'; });
			});
		}

		// On mouse down
		if (down) {
			Client.loadFile(DB.INTERFACE_PATH + down, function (dataURI)
			{
				$node.mousedown(function (event) { this.style.backgroundImage = 'url(' + dataURI + ')'; event.stopImmediatePropagation(); });
				$node.mouseup(function () { this.style.backgroundImage = 'url(' + (hover_uri || bg_uri) + ')'; });
			});

			if (!hover) {
				$node.mouseout(function () { this.style.backgroundImage = 'url(' + bg_uri + ')'; });
			}
		}

		// Preload images ?
		if (preload) {
			preloads = preload.split(';');
			for (i = 0, count = preloads.length; i < count; ++i) {
				preloads[i] = DB.INTERFACE_PATH + jQuery.trim(preloads[i]);
			}
			Client.loadFiles(preloads);
		}
	};
Beispiel #2
0
	SlotMachine.init = function init()
	{
		// Initialize UI.
		this.ui = jQuery('<canvas/>')
			.attr({
				width:  270,
				height: 260,
				id:     'SlotMachine'
			})
			.css({
				zIndex:   500,
				position: 'absolute',
				top:      (Renderer.height / 2) - 130,
				left:     (Renderer.width  / 2) - 135
			});

		_ctx  = this.ui[0].getContext('2d');


		// Loading sprite, start animation
		Client.loadFiles(['data/sprite/slotmachine.spr', 'data/sprite/slotmachine.act'], function(spr, act) {
			_sprite = spr;
			_action = act;
			_type   = 0;
			_start  = Renderer.tick;

			if (this.ui[0].parentNode) {
				Renderer.render(rendering);
			}
		}.bind(this));


		// Don't propagate to map scene
		this.ui.mousedown(function(event) {
			if (_type === 0) {
				SlotMachine.onTry();
				event.stopImmediatePropagation();
				return false;
			}
		});
	};
Beispiel #3
0
	ChatBox.init = function Init()
	{
		this.history = [];
		this.historyIndex = 0;

		this.ui.css('top', (Renderer.height - ( this.ui.find('.content').height() + 53 )) + 'px');
		this.draggable( this.ui.find('.input') );

		// Setting chatbox scrollbar
		Client.loadFiles([DB.INTERFACE_PATH + "basic_interface/dialscr_down.bmp", DB.INTERFACE_PATH + "basic_interface/dialscr_up.bmp"], function( down, up ){
			jQuery("style:first").append([
				"#chatbox .content::-webkit-scrollbar { width: 10px; height: 10px;}",
				"#chatbox .content::-webkit-scrollbar-button:vertical:start:increment,",
				"#chatbox .content::-webkit-scrollbar-button:vertical:end:decrement { display: none;}",
				"#chatbox .content::-webkit-scrollbar-corner:vertical { display:none;}",
				"#chatbox .content::-webkit-scrollbar-resizer:vertical { display:none;}",
				"#chatbox .content::-webkit-scrollbar-button:start:decrement,",
				"#chatbox .content::-webkit-scrollbar-button:end:increment { display: block; border:none;}",
				"#chatbox .content::-webkit-scrollbar-button:vertical:increment { background: url('"+ down +"') no-repeat; height:10px;}",
				"#chatbox .content::-webkit-scrollbar-button:vertical:decrement { background: url('"+ up +"') no-repeat; height:10px;}",
				"#chatbox .content::-webkit-scrollbar-track-piece:vertical { background:black; border:none;}",
				"#chatbox .content::-webkit-scrollbar-thumb:vertical { background:grey; -webkit-border-image:none; border-color:transparent;border-width: 0px 0; }"
			].join("\n"));
		});

		// Input selection
		this.ui.find('.input input').mousedown(function( event ){
			this.select();
			event.stopImmediatePropagation();
			return false;
		});

		this.ui.find('.input .message').blur(function(){
			var _this = this;
			setTimeout(function(){
				if( document.activeElement.tagName !== 'INPUT' ) {
					_this.focus();
				}
			}, 1);
		});

		// Button change name
		this.ui.find('.header input').dblclick(function(){
			this.type = 'text';
			this.select();
		}).blur(function(){
			this.type = 'button';
		});

		// Change size
		this.ui.find('.input .size').mousedown(function( event ){
			ChatBox.updateHeight(true);
			event.stopImmediatePropagation();
			return false;
		});

		// Scroll feature should block at each line
		this.ui.find('.content').on('scroll', function(){
			this.scrollTop = Math.floor(this.scrollTop/14) * 14;
		});
	};
Beispiel #4
0
	ChatBox.init = function init()
	{
		_heightIndex = _preferences.height - 1;
		ChatBox.updateHeight();

		this.ui.css({
			top:  Math.min( Math.max( 0, _preferences.y - this.ui.height()), Renderer.height - this.ui.height()),
			left: Math.min( Math.max( 0, _preferences.x), Renderer.width  - this.ui.width())
		});

		this.draggable( this.ui.find('.input') );

		// Sorry for this un-documented code (see UIComponent for more informations)
		this.__mouseStopBlock = this.ui.find('.input');

		// Setting chatbox scrollbar
		Client.loadFiles([DB.INTERFACE_PATH + 'basic_interface/dialscr_down.bmp', DB.INTERFACE_PATH + 'basic_interface/dialscr_up.bmp'], function( down, up ){
			jQuery('style:first').append([
				'#chatbox .content::-webkit-scrollbar { width: 10px; height: 10px;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:start:increment,',
				'#chatbox .content::-webkit-scrollbar-button:vertical:end:decrement { display: none;}',
				'#chatbox .content::-webkit-scrollbar-corner:vertical { display:none;}',
				'#chatbox .content::-webkit-scrollbar-resizer:vertical { display:none;}',
				'#chatbox .content::-webkit-scrollbar-button:start:decrement,',
				'#chatbox .content::-webkit-scrollbar-button:end:increment { display: block; border:none;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:increment { background: url('+ down +') no-repeat; height:10px;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:decrement { background: url('+ up +') no-repeat; height:10px;}',
				'#chatbox .content::-webkit-scrollbar-track-piece:vertical { background:black; border:none;}',
				'#chatbox .content::-webkit-scrollbar-thumb:vertical { background:grey; -webkit-border-image:none; border-color:transparent;border-width: 0px 0; }'
			].join('\n'));
		});

		// Input selection
		this.ui.find('.input input').mousedown(function( event ){
			this.select();
			event.stopImmediatePropagation();
			return false;
		});

		this.ui.find('.input .message').blur(function(){
			Events.setTimeout(function(){
				if (!document.activeElement.tagName.match(/input|select|textarea/i)) {
					this.focus();
				}
			}.bind(this), 1);
		});

		// Button change name
		this.ui.find('.header input').dblclick(function(){
			this.type = 'text';
			this.select();
		}).blur(function(){
			this.type = 'button';
		});

		// Private message selection
		this.ui.find('.input .list').click(function(){
			var names = _historyNickName.list;
			var i, count = names.length;
			var pos = jQuery(this).offset();
			var ui = ContextMenu.ui.find('.menu');

			if (!count) {
				ChatBox.addText( DB.getMessage(192), ChatBox.TYPE.ERROR);
				return;
			}

			ContextMenu.remove();
			ContextMenu.append();

			for (i = 0; i < count; ++i) {
				ContextMenu.addElement(names[i], onPrivateMessageUserSelection(names[i]));
			}

			ContextMenu.addElement('', onPrivateMessageUserSelection(''));
			ui.css({
				top:  pos.top - ui.height() - 5,
				left: pos.left - ui.width() - 5
			});
		}).mousedown(function(event){
			event.stopImmediatePropagation();
			return false;
		});

		// Send message to...
		this.ui.find('.input .filter').click(function(){
			var pos = jQuery(this).offset();
			var ui = ContextMenu.ui.find('.menu');

			ContextMenu.remove();
			ContextMenu.append();

			ContextMenu.addElement(DB.getMessage(85),  onChangeTargetMessage(ChatBox.TYPE.PUBLIC));
			ContextMenu.addElement(DB.getMessage(86),  onChangeTargetMessage(ChatBox.TYPE.PARTY));
			ContextMenu.addElement(DB.getMessage(437), onChangeTargetMessage(ChatBox.TYPE.GUILD));

			ui.css({
				top:  pos.top - ui.height() - 5,
				left: pos.left - ui.width() + 25
			});
		}).mousedown(function(event){
			event.stopImmediatePropagation();
			return false;
		});

		// Change size
		this.ui.find('.input .size').click(function( event ){
			ChatBox.updateHeight(true);
			event.stopImmediatePropagation();
			return false;
		});

		// Scroll feature should block at each line
		this.ui.find('.content').on('mousewheel DOMMouseScroll', onScroll);
	};
Beispiel #5
0
	ChatBox.init = function init()
	{
		this.ui.css('top', (Renderer.height - ( this.ui.find('.content').height() + 53 )) + 'px');
		this.draggable( this.ui.find('.input') );

		// Setting chatbox scrollbar
		Client.loadFiles([DB.INTERFACE_PATH + 'basic_interface/dialscr_down.bmp', DB.INTERFACE_PATH + 'basic_interface/dialscr_up.bmp'], function( down, up ){
			jQuery('style:first').append([
				'#chatbox .content::-webkit-scrollbar { width: 10px; height: 10px;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:start:increment,',
				'#chatbox .content::-webkit-scrollbar-button:vertical:end:decrement { display: none;}',
				'#chatbox .content::-webkit-scrollbar-corner:vertical { display:none;}',
				'#chatbox .content::-webkit-scrollbar-resizer:vertical { display:none;}',
				'#chatbox .content::-webkit-scrollbar-button:start:decrement,',
				'#chatbox .content::-webkit-scrollbar-button:end:increment { display: block; border:none;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:increment { background: url('+ down +') no-repeat; height:10px;}',
				'#chatbox .content::-webkit-scrollbar-button:vertical:decrement { background: url('+ up +') no-repeat; height:10px;}',
				'#chatbox .content::-webkit-scrollbar-track-piece:vertical { background:black; border:none;}',
				'#chatbox .content::-webkit-scrollbar-thumb:vertical { background:grey; -webkit-border-image:none; border-color:transparent;border-width: 0px 0; }'
			].join('\n'));
		});

		// Input selection
		this.ui.find('.input input').mousedown(function( event ){
			this.select();
			event.stopImmediatePropagation();
			return false;
		});

		this.ui.find('.input .message').blur(function(){
			setTimeout(function(){
				if (!document.activeElement.tagName.match(/input|select|textarea/i)) {
					this.focus();
				}
			}.bind(this), 1);
		});

		// Button change name
		this.ui.find('.header input').dblclick(function(){
			this.type = 'text';
			this.select();
		}).blur(function(){
			this.type = 'button';
		});

		// Change size
		this.ui.find('.input .size').mousedown(function( event ){
			ChatBox.updateHeight(true);
			event.stopImmediatePropagation();
			return false;
		});

		// Scroll feature should block at each line
		var lastScrollPos = 0;
		this.ui.find('.content').on('scroll', function(){
			if (this.scrollTop > lastScrollPos) {
				this.scrollTop = Math.ceil(this.scrollTop/14) * 14;
			}
			else {
				this.scrollTop = Math.floor(this.scrollTop/14) * 14;
			}
			lastScrollPos = this.scrollTop;
		});
	};