initial commit

This commit is contained in:
lopar
2018-01-28 18:40:49 +02:00
commit 46c75d1542
8193 changed files with 183296 additions and 0 deletions
+361
View File
@@ -0,0 +1,361 @@
/*!
* zeroclipboard
* The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface.
* Copyright 2012 Jon Rohan, James M. Greene, .
* Released under the MIT license
* http://jonrohan.github.com/ZeroClipboard/
* v1.1.7
*/(function() {
"use strict";
var _getStyle = function(el, prop) {
var y = el.style[prop];
if (el.currentStyle) y = el.currentStyle[prop]; else if (window.getComputedStyle) y = document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);
if (y == "auto" && prop == "cursor") {
var possiblePointers = [ "a" ];
for (var i = 0; i < possiblePointers.length; i++) {
if (el.tagName.toLowerCase() == possiblePointers[i]) {
return "pointer";
}
}
}
return y;
};
var _elementMouseOver = function(event) {
if (!ZeroClipboard.prototype._singleton) return;
if (!event) {
event = window.event;
}
var target;
if (this !== window) {
target = this;
} else if (event.target) {
target = event.target;
} else if (event.srcElement) {
target = event.srcElement;
}
ZeroClipboard.prototype._singleton.setCurrent(target);
};
var _addEventHandler = function(element, method, func) {
if (element.addEventListener) {
element.addEventListener(method, func, false);
} else if (element.attachEvent) {
element.attachEvent("on" + method, func);
}
};
var _removeEventHandler = function(element, method, func) {
if (element.removeEventListener) {
element.removeEventListener(method, func, false);
} else if (element.detachEvent) {
element.detachEvent("on" + method, func);
}
};
var _addClass = function(element, value) {
if (element.addClass) {
element.addClass(value);
return element;
}
if (value && typeof value === "string") {
var classNames = (value || "").split(/\s+/);
if (element.nodeType === 1) {
if (!element.className) {
element.className = value;
} else {
var className = " " + element.className + " ", setClass = element.className;
for (var c = 0, cl = classNames.length; c < cl; c++) {
if (className.indexOf(" " + classNames[c] + " ") < 0) {
setClass += " " + classNames[c];
}
}
element.className = setClass.replace(/^\s+|\s+$/g, "");
}
}
}
return element;
};
var _removeClass = function(element, value) {
if (element.removeClass) {
element.removeClass(value);
return element;
}
if (value && typeof value === "string" || value === undefined) {
var classNames = (value || "").split(/\s+/);
if (element.nodeType === 1 && element.className) {
if (value) {
var className = (" " + element.className + " ").replace(/[\n\t]/g, " ");
for (var c = 0, cl = classNames.length; c < cl; c++) {
className = className.replace(" " + classNames[c] + " ", " ");
}
element.className = className.replace(/^\s+|\s+$/g, "");
} else {
element.className = "";
}
}
}
return element;
};
var _getDOMObjectPosition = function(obj) {
var info = {
left: 0,
top: 0,
width: obj.width || obj.offsetWidth || 0,
height: obj.height || obj.offsetHeight || 0,
zIndex: 9999999
};
var zi = _getStyle(obj, "zIndex");
if (zi && zi != "auto") {
info.zIndex = parseInt(zi, 10);
}
while (obj) {
var borderLeftWidth = parseInt(_getStyle(obj, "borderLeftWidth"), 10);
var borderTopWidth = parseInt(_getStyle(obj, "borderTopWidth"), 10);
info.left += isNaN(obj.offsetLeft) ? 0 : obj.offsetLeft;
info.left += isNaN(borderLeftWidth) ? 0 : borderLeftWidth;
info.top += isNaN(obj.offsetTop) ? 0 : obj.offsetTop;
info.top += isNaN(borderTopWidth) ? 0 : borderTopWidth;
obj = obj.offsetParent;
}
return info;
};
var _noCache = function(path) {
return (path.indexOf("?") >= 0 ? "&" : "?") + "nocache=" + (new Date).getTime();
};
var _vars = function(options) {
var str = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
str.push("trustedDomain=" + options.trustedDomains);
} else {
str.push("trustedDomain=" + options.trustedDomains.join(","));
}
}
return str.join("&");
};
var _inArray = function(elem, array) {
if (array.indexOf) {
return array.indexOf(elem);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === elem) {
return i;
}
}
return -1;
};
var _prepGlue = function(elements) {
if (typeof elements === "string") throw new TypeError("ZeroClipboard doesn't accept query strings.");
if (!elements.length) return [ elements ];
return elements;
};
var ZeroClipboard = function(elements, options) {
if (elements) (ZeroClipboard.prototype._singleton || this).glue(elements);
if (ZeroClipboard.prototype._singleton) return ZeroClipboard.prototype._singleton;
ZeroClipboard.prototype._singleton = this;
this.options = {};
for (var kd in _defaults) this.options[kd] = _defaults[kd];
for (var ko in options) this.options[ko] = options[ko];
this.handlers = {};
if (ZeroClipboard.detectFlashSupport()) _bridge();
};
var currentElement, gluedElements = [];
ZeroClipboard.prototype.setCurrent = function(element) {
currentElement = element;
this.reposition();
if (element.getAttribute("title")) {
this.setTitle(element.getAttribute("title"));
}
this.setHandCursor(_getStyle(element, "cursor") == "pointer");
};
ZeroClipboard.prototype.setText = function(newText) {
if (newText && newText !== "") {
this.options.text = newText;
if (this.ready()) this.flashBridge.setText(newText);
}
};
ZeroClipboard.prototype.setTitle = function(newTitle) {
if (newTitle && newTitle !== "") this.htmlBridge.setAttribute("title", newTitle);
};
ZeroClipboard.prototype.setSize = function(width, height) {
if (this.ready()) this.flashBridge.setSize(width, height);
};
ZeroClipboard.prototype.setHandCursor = function(enabled) {
if (this.ready()) this.flashBridge.setHandCursor(enabled);
};
ZeroClipboard.version = "1.1.7";
var _defaults = {
moviePath: "ZeroClipboard.swf",
trustedDomains: null,
text: null,
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
allowScriptAccess: "sameDomain"
};
ZeroClipboard.setDefaults = function(options) {
for (var ko in options) _defaults[ko] = options[ko];
};
ZeroClipboard.destroy = function() {
ZeroClipboard.prototype._singleton.unglue(gluedElements);
var bridge = ZeroClipboard.prototype._singleton.htmlBridge;
bridge.parentNode.removeChild(bridge);
delete ZeroClipboard.prototype._singleton;
};
ZeroClipboard.detectFlashSupport = function() {
var hasFlash = false;
try {
if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) {
hasFlash = true;
}
} catch (error) {
if (navigator.mimeTypes["application/x-shockwave-flash"]) {
hasFlash = true;
}
}
return hasFlash;
};
var _bridge = function() {
var client = ZeroClipboard.prototype._singleton;
var container = document.getElementById("global-zeroclipboard-html-bridge");
if (!container) {
var html = ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="' + client.options.moviePath + _noCache(client.options.moviePath) + '"/> <param name="allowScriptAccess" value="' + client.options.allowScriptAccess + '"/> <param name="scale" value="exactfit"/> <param name="loop" value="false"/> <param name="menu" value="false"/> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff"/> <param name="wmode" value="transparent"/> <param name="flashvars" value="' + _vars(client.options) + '"/> <embed src="' + client.options.moviePath + _noCache(client.options.moviePath) + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + _vars(client.options) + '" scale="exactfit"> </embed> </object>';
container = document.createElement("div");
container.id = "global-zeroclipboard-html-bridge";
container.setAttribute("class", "global-zeroclipboard-container");
container.setAttribute("data-clipboard-ready", false);
container.style.position = "absolute";
container.style.left = "-9999px";
container.style.top = "-9999px";
container.style.width = "15px";
container.style.height = "15px";
container.style.zIndex = "9999";
container.innerHTML = html;
document.body.appendChild(container);
}
client.htmlBridge = container;
client.flashBridge = document["global-zeroclipboard-flash-bridge"] || container.children[0].lastElementChild;
};
ZeroClipboard.prototype.resetBridge = function() {
this.htmlBridge.style.left = "-9999px";
this.htmlBridge.style.top = "-9999px";
this.htmlBridge.removeAttribute("title");
this.htmlBridge.removeAttribute("data-clipboard-text");
_removeClass(currentElement, this.options.activeClass);
currentElement = null;
this.options.text = null;
};
ZeroClipboard.prototype.ready = function() {
var ready = this.htmlBridge.getAttribute("data-clipboard-ready");
return ready === "true" || ready === true;
};
ZeroClipboard.prototype.reposition = function() {
if (!currentElement) return false;
var pos = _getDOMObjectPosition(currentElement);
this.htmlBridge.style.top = pos.top + "px";
this.htmlBridge.style.left = pos.left + "px";
this.htmlBridge.style.width = pos.width + "px";
this.htmlBridge.style.height = pos.height + "px";
this.htmlBridge.style.zIndex = pos.zIndex + 1;
this.setSize(pos.width, pos.height);
};
ZeroClipboard.dispatch = function(eventName, args) {
ZeroClipboard.prototype._singleton.receiveEvent(eventName, args);
};
ZeroClipboard.prototype.on = function(eventName, func) {
var events = eventName.toString().split(/\s/g);
for (var i = 0; i < events.length; i++) {
eventName = events[i].toLowerCase().replace(/^on/, "");
if (!this.handlers[eventName]) this.handlers[eventName] = func;
}
if (this.handlers.noflash && !ZeroClipboard.detectFlashSupport()) {
this.receiveEvent("onNoFlash", null);
}
};
ZeroClipboard.prototype.addEventListener = ZeroClipboard.prototype.on;
ZeroClipboard.prototype.off = function(eventName, func) {
var events = eventName.toString().split(/\s/g);
for (var i = 0; i < events.length; i++) {
eventName = events[i].toLowerCase().replace(/^on/, "");
for (var event in this.handlers) {
if (event === eventName && this.handlers[event] === func) {
delete this.handlers[event];
}
}
}
};
ZeroClipboard.prototype.removeEventListener = ZeroClipboard.prototype.off;
ZeroClipboard.prototype.receiveEvent = function(eventName, args) {
eventName = eventName.toString().toLowerCase().replace(/^on/, "");
var element = currentElement;
switch (eventName) {
case "load":
if (args && parseFloat(args.flashVersion.replace(",", ".").replace(/[^0-9\.]/gi, "")) < 10) {
this.receiveEvent("onWrongFlash", {
flashVersion: args.flashVersion
});
return;
}
this.htmlBridge.setAttribute("data-clipboard-ready", true);
break;
case "mouseover":
_addClass(element, this.options.hoverClass);
break;
case "mouseout":
_removeClass(element, this.options.hoverClass);
this.resetBridge();
break;
case "mousedown":
_addClass(element, this.options.activeClass);
break;
case "mouseup":
_removeClass(element, this.options.activeClass);
break;
case "datarequested":
var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
if (targetEl) {
var textContent = targetEl.value || targetEl.textContent || targetEl.innerText;
if (textContent) this.setText(textContent);
} else {
var defaultText = element.getAttribute("data-clipboard-text");
if (defaultText) this.setText(defaultText);
}
break;
case "complete":
this.options.text = null;
break;
}
if (this.handlers[eventName]) {
var func = this.handlers[eventName];
if (typeof func == "function") {
func.call(element, this, args);
} else if (typeof func == "string") {
window[func].call(element, this, args);
}
}
};
ZeroClipboard.prototype.glue = function(elements) {
elements = _prepGlue(elements);
for (var i = 0; i < elements.length; i++) {
if (_inArray(elements[i], gluedElements) == -1) {
gluedElements.push(elements[i]);
_addEventHandler(elements[i], "mouseover", _elementMouseOver);
}
}
};
ZeroClipboard.prototype.unglue = function(elements) {
elements = _prepGlue(elements);
for (var i = 0; i < elements.length; i++) {
_removeEventHandler(elements[i], "mouseover", _elementMouseOver);
var arrayIndex = _inArray(elements[i], gluedElements);
if (arrayIndex != -1) gluedElements.splice(arrayIndex, 1);
}
};
if (typeof module !== "undefined") {
module.exports = ZeroClipboard;
} else if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else {
window.ZeroClipboard = ZeroClipboard;
}
})();
+75
View File
@@ -0,0 +1,75 @@
var base = {
/* Конфигурации */
config: {
'type':'none'
},
/* Хранилище данных */
init:function( p, v) {
if( v == null ) {
delete this.config[p];
}else{
this.config[p] = v;
}
},
/* Хранилище данных , NONE */
storage: { },
/* Получение данных */
out:function( q ) {
var obj = false;
if( this.config['type'] == 'none' ) {
if( !this.storage[q] ) {
obj = false;
}else{
obj = this.storage[q];
}
}else if( this.config['type'] == 'flash' ) {
}else if( this.config['type'] == 'html5' ) {
}
return obj;
},
/* Сохранение данных */
inc:function( q, obj , type ) {
if( this.config['type'] == 'none' ) {
if( type != true ) {
obj = $.parseJSON( obj );
}
if( !this.storage[q] ) {
//Сохраняем
this.storage[q] = obj;
}else{
//Перезаписываем
this.storage[q] = obj;
}
}else if( this.config['type'] == 'flash' ) {
}else if( this.config['type'] == 'html5' ) {
}
},
/* Удаление данных */
deleted:function( q ) {
if( this.config['type'] == 'none' ) {
if( !this.storage[q] ) {
//Удаляем
}else{
//Перезаписываем
delete this.storage[q];
}
}else if( this.config['type'] == 'flash' ) {
}else if( this.config['type'] == 'html5' ) {
}
}
};
+496
View File
@@ -0,0 +1,496 @@
var cfg = {
'host':'new.capitalcity.old-dark.ru',
'img':'new.capitalcity.old-dark.ru/static/'
};
var GameEngine = {
start:function() {
ReLine.start();
ReLine.rebase();
chat.refleshChat(false);
chat.refleshSmiles();
this.actionSecondStart();
this.timeStempReflesh();
/* онлайн меню */
this.onlinebtn('Локация');
this.onlinebtn('Друзья');
this.onlinebtn('Модераторы');
this.onlinebtn('Дилеры');
//mod.start();
$('#preloader').remove();
},
hasFlashVar:'none',
hasFlash:function() {
if(this.hasFlashVar == 'none') {
this.hasFlashVar = (typeof navigator.plugins == "undefined" || navigator.plugins.length == 0) ? !!(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) : navigator.plugins["Shockwave Flash"];
}
return this.hasFlashVar;
},
ch10:function(v) {
if( v == 'checked' ) {
return 1;
}else{
return 0;
}
},
timeStempReflesh:function() {
if( this.hasFlash() ) {
$('#timeStemp').html(
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="25">'+
'<param name="movie" value="http://' + cfg.host + '/static/flash/clock.swf?hours=' + this.data('H') + '&amp;minutes=' + this.data('i') + '&amp;sec=' + this.data('s') + '">'+
'<param name="quality" value="high">'+
'<embed src="http://' + cfg.host + '/static/flash/clock.swf?hours=' + this.data('H') + '&minutes=' + this.data('i') + '&sec=' + this.data('s') + '" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="25"></embed>'+
'</object>'
);
}else{
$('#timeStemp').html('').css('display','none');
}
},
onlinebtnsel:function(id) {
var i = 1;
while(i <= this.onbtn_id) {
$('#onbtn_'+i).removeClass('onbtn_1');
$('#onbtn_'+i).removeClass('onbtn_2');
$('#onbtn_'+i).removeClass('onbtn_3');
$('#onbtn_'+i).addClass('onbtn_2');
i++;
}
$('#onbtn_'+id).removeClass('onbtn_2');
$('#onbtn_'+id).addClass('onbtn_1');
},
onbtn_id:0,
onlinebtn:function(title) {
this.onbtn_id++;
var stl = 1;
if(this.onbtn_id > 1) {
stl = 2;
}
var html = '<span id="onbtn_' + this.onbtn_id + '" onclick="GameEngine.onlinebtnsel('+this.onbtn_id+')" class="onbtn_' + stl + '" title="' + title + '">'+
'<img src="http://' + cfg.img + 'images/oico' + this.onbtn_id + '.png" width="38" height="29">' +
'</span>';
$('#omnav').html( $('#omnav').html() + html );
},
actSec:[false, 0, 'stop', 0, {}],
addAction:function( name, value, timeDelete ) {
this.actSec[4][name] = value;
if(timeDelete > 0) {
setTimeout(function(){ GameEngine.deleteAction(name); },1000*timeDelete);
}
},
deleteAction:function( name ) {
delete this.actSec[4][name];
},
tnln:function(n,t) {
if(t == true) {
return '<span class="rstmn rstmn'+n+'"></span>';
}else{
return '<small>' + n + '</small>';
}
},
timeNowLook:function() {
var html = '', rstime = '', rsmenu = '', rsh = '', rsm = '', rss = '';
rsh = this.data('H');
if(rsh < 10) {
//rsh = [0,rsh];
}
rsm = this.data('i');
if(rsm < 10) {
//rsm = [0,rsm];
}
rss = this.data('s');
if(rss < 10) {
//rss = [0,rss];
}
rsh = this.tnln(rsh[0],true) + '' + this.tnln(rsh[1],true);
rsm = this.tnln(rsm[0],true) + '' + this.tnln(rsm[1],true);
rss = this.tnln(rss[0],false) + '' + this.tnln(rss[1],false);
rstime = '<span class="rstm">' + rsh + '<span class="rstmn rstmnrz"></span>' + rsm + '</span><span class="rstmsec">' + rss + '</span>';
rsmenu = '<div class="rsmn" align="center"><font color="red">server</font> time</div>';
html = '<table class="rsTimeNow" width="70" height="25" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td>'+
'<table width="70" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td height="20" align="left">'+
rstime+
'</td>'+
'</tr>'+
'<tr>'+
'<td height="5">'+
rsmenu+
'</td>'+
'</tr>'+
'</table>'+
'</td>'+
'</tr>'+
'</table>';
$('#timeNowLook').html( html );
setTimeout('GameEngine.timeNowLook()',500);
},
actSecTimer:null,
actionSecondStart:function() {
//window.ref = setInterval(function(){ GameEngine.actionSecond('second'); },1000);
/*$(window).everyTime(1000, 'timerAction', function(i) {
GameEngine.actionSecond('second');
});*/
},
actionSecond:function(type) {
//clearInterval(window.ref);
if( type != 'stop' && type != 'pause' ) {
//Выполняем действия каждую секунду
var i = 0;
var widthRange = {'test':'test2','test3':4}; //массив
for (var key in this.actSec[4]) {
if (key === 'length' || !this.actSec[4].hasOwnProperty(key)) continue;
var value = this.actSec[4][key];
value();
//eval( value );
}
delete key;
delete value;
}
if( ( type == 'stop' || type == 'start' || type == 'pause' ) && this.actSec[2] != type ) {
this.actSec[2] = type;
}
//this.actionSecondStart();
},
error:function(v) {
/*
Функция вывода ошибок
*/
alert(v);
},
c:function(v) {
/*
мини-вариант функции this.console
*/
this.console(v);
},
console:function(v) {
/*
Добавление данных в консоль
*/
date = new Date();
console.log("["+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()+"] "+v);
},
fm:function( v , e) {
if (!e) e = window.event;
if( v == 'onclick' ) {
if( chat.context_open == true ) {
chat.contextmenu_close();
}
if( chat.context_global_open == true ) {
chat.contextmenu_global_close();
}
}else if( v == 'contextmenu' ) {
if( chat.context_open == true ) {
//chat.contextmenu_close();
}
if( chat.context_global_open == true ) {
//chat.contextmenu_global_close();
}
}else if( v == 'contextmenu_main' || v == 'contextmenu_chat' || v == 'contextmenu_online' ) {
v = v.replace('contextmenu_','');
chat.contextMenuGlobal( v , e);
}
},
merge_arrays:function(arr) {
var merged_array = arr;
for (var i = 1; i < arguments.length; i++) {
merged_array = merged_array.concat(arguments[i]);
}
return merged_array;
},
post_date:['',{},0],
post:function(date, only) {
//Какое-то обновление информации :)
if( only == null ) {
var arr = [
'',
$.extend(date[1],this.post_date[1]),
function(data) {
if(typeof(date[2])=='string') {
//eval(date[2]+'(data)');
eval('GameEngine.post_back(data,"'+date[2]+'",false)');
if( GameEngine.post_date[2] != 0 ) {
//eval(GameEngine.post_date[2]+'(data)');
eval('GameEngine.post_back(data,"'+GameEngine.post_date[2]+'",false)');
}
}else{
//eval(date[2][0]);
eval('GameEngine.post_back(data,\''+date[2][0]+'\',true)');
}
}
];
}else{
var arr = ['',date[1],date[2]];
}
//Параметры версий
if( !arr[1]['version'] ) {
arr[1]['version'] = this.version();
}else if( arr[1]['version'] == 'delete' ) {
delete arr[1]['version'];
}
$.post(date[0],arr[1],arr[2]);
this.post_date = ['',{},0];
},
core:function(data) {
//Обработка событий ядра
},
post_back:function(data,fx,cl) {
if( typeof(data) == 'string' ) {
da = $.parseJSON( data );
//Проводим операции
if( da['core'] != undefined) {
this.core(da['core']);
if( da['core']['back_arr'] == true ) {
//Возвращаем массив
data = '[' + this.to_array( da ) + ']';
}
}
delete da;
}
if( cl == false ) {
eval(fx+'(data)');
}else{
eval(fx);
}
},
to_array:function (obj) {
var arr = [];
var i = 0;
while( i > -1 ) {
if(obj[i] == undefined) {
i = -2;
}else{
//arr += '['+obj[i]+'],';
if(typeof(obj[i]) == 'number') {
arr[i] = obj[i];
}else{
arr[i] = '['+obj[i]+']';
}
}
i++;
}
//arr = arr.substring(0, arr.length - 1);
return arr;
},
trim:function(s) {
return this.rtrim(this.ltrim(s));
},
ltrim:function(s) {
return s.replace(/^\s+/, '');
},
rtrim:function(s) {
return s.replace(/\s+$/, '');
},
str_replace:function ( search, replace, subject ) {
if(!(replace instanceof Array)){
replace=new Array(replace);
if(search instanceof Array){
while(search.length>replace.length){
replace[replace.length]=replace[0];
}
}
}
if(!(search instanceof Array))search=new Array(search);
while(search.length>replace.length){
replace[replace.length]='';
}
if(subject instanceof Array){
for(k in subject){
subject[k]=str_replace(search,replace,subject[k]);
}
return subject;
}
for(var k=0; k<search.length; k++){
var i = subject.indexOf(search[k]);
while(i>-1){
subject = subject.replace(search[k], replace[k]);
i = subject.indexOf(search[k],i);
}
}
return subject;
},
timeSdvig:0,
timeReson:0,
timeSd:function( time ) {
this.timeSdvig = this.timenow();
this.timeReson = time;
},
timenow:function(){
//return ( parseInt(new Date().getTime()/1000));
return parseInt( this.timeReson + ( parseInt(new Date().getTime()/1000) - this.timeSdvig ) );
},
px:function( v ) {
return parseInt( ( v ).replace( "px", "" ) );
},
divxyBanned:function( obj ) {
//Блокировка элемента, если он выходит за пределы окна обзора
var obj = $(obj);
var bnpx = [25,33,3,1];
//var win = this.getPageSize();
//По Y
if( obj.height() + this.px( obj.css('top') ) + bnpx[1] > $('#fm').height() ) {
obj.css({'top':( $('#fm').height() - bnpx[1] - obj.height() )+'px'});
}else if( this.px( obj.css('top') ) - bnpx[0] < 0 ) {
obj.css({'top':( bnpx[0] )+'px'});
}
//По X
if( obj.width() + this.px( obj.css('left') ) + bnpx[2] > $('#fm').width() ) {
obj.css({'left':( $('#fm').width() - bnpx[2] - obj.width() )+'px'});
}else if( this.px( obj.css('left') ) - bnpx[3] < 0 ) {
obj.css({'left':( bnpx[3] )+'px'});
}
},
getPageSize:function(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
xScroll = document.documentElement.scrollWidth;
yScroll = document.documentElement.scrollHeight;
} else { // Explorer Mac...would also work in Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
return [pageWidth,pageHeight,windowWidth,windowHeight];
},
data:function(format,UNIX_timestamp){
if(UNIX_timestamp == null) {
UNIX_timestamp = this.timenow();
}
var a = new Date(UNIX_timestamp*1000);
var months = ['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'];
var year = a.getFullYear();
var month = a.getMonth();
var date = a.getDay();
var hour = a.getHours();
var min = a.getMinutes();
var sec = a.getSeconds();
var time = format;
month += 1;
if(date < 10) {
date = '0'+date;
}
if(month < 10) {
month = '0'+month;
}
if(hour < 10) {
hour = '0'+hour;
}
if(min < 10) {
min = '0'+min;
}
if(sec < 10) {
sec = '0'+sec;
}
time = this.str_replace('d',''+date,time);
time = this.str_replace('m',''+month,time);
time = this.str_replace('Y',''+year,time);
time = this.str_replace('H',''+hour,time);
time = this.str_replace('i',''+min,time);
time = this.str_replace('s',''+sec,time);
return time;
},
loginLook:function(id,login,level,clan,align,type) {
var html = '';
if( type == 1 ) {
html = '<a class="cp">' + login + '</a>';
}else if( type == 2 ) {
html = '<b>' + login + '</b>';
}
html += ' [' + level + ']';
html += '<a target="_blank" title="Инф. о ' + login + '" href="http://' + cfg.host + '/userinfo/' + id + '"><img src="http://' + cfg.img + 'images/inf.gif" width="12" height="11"></a>';
return html;
}
};
function showtable(id) {
hidesel(id);
hidemenu(0);
document.getElementById('menu'+id).style.display = '';
}
function hidemenu (time) {
for (var i=1;i<=4;i++) {
document.getElementById('menu'+i).style.display = 'none';
}
}
function hidesel (id) {
for (var i=1;i<=5;i++) {
if (i!=id) {document.getElementById('el'+i).style.backgroundColor='';document.getElementById('el'+i).style.color='';}
}
}
+256
View File
@@ -0,0 +1,256 @@
var ReLine = {
v:[0,0],
start:function() {
$('#elements').html('<div id="bline" style="display:none" onselectstart="return false"></div><div id="hline" onselectstart="return false"><img class="hlinelz" src="http://'+cfg.host+'/1x1.gif" width="8" height="4" /><img class="hlinerz" src="http://'+cfg.host+'/1x1.gif" width="10" height="4" /><img class="dn" src="http://'+cfg.host+'/1x1.gif" width="100%" height="1" /></div><div id="vline" onselectstart="return false"><img class="dn" onselectstart="return false" src="http://'+cfg.host+'/1x1.gif" width="1" height="50%" /></div>');
$('#hline').bind('mousedown',function() {
top.ReLine.startHline();
});
$('#vline').bind('mousedown',function() {
top.ReLine.startVline();
});
$('#bline').mouseup(function() {
top.ReLine.stopVline();
top.ReLine.stopHline();
});
$(window).resize(function(){top.ReLine.resetHVLine()});
this.resetHVLine();
},
resetHVLine:function(e) {
$('#hline').css({
'top':($('#chat_online').offset().top)+'px'
});
$('#vline').css({
'left':($('#online').offset().left)+'px',
'top':($('#online').offset().top)+'px',
'height':($('#online').height())+'px'
});
$('#fm_main').height( ($(window).height()-$('#online').height()-55-18) + 'px' );
$('#main').height( ($(window).height()-$('#online').height()-55-18) + 'px' );
},
goHVLine:function(e) {
if(this.v[0] == 1) {
chat.testScrollMessages();
//hline
var hp = Math.floor(($(window).height()-$('#hline').offset().top+25)/$(window).height()*100);
$('#fm_main').height('0%');
$('#fmain').height('0%');
$('#fm_chat_online').height('0%');
$('#chat_list').height('1px');
$('#canals').height('1px');
$('#online_list').height('1px');
if(hp > 97) {
if($('#fm_main').css('display') != 'none') {
$('#fm_main').css({'display':'none'});
$('#fm_main_l').css({'display':'none'});
$('#fm_main_r').css({'display':'none'});
}
if($('#chat').css('display') == 'none'){
$('#chat').css({'display':''});
$('#online').css({'display':''});
$('#vline').css({'display':''});
$('#send_btns_h').css({'display':''});
$('#send_btns_h2').css({'display':'none'});
}
hp = 100;
}else if($('#fm_main').css('display') == 'none'){
$('#fm_main').css({'display':''});
$('#fm_main_l').css({'display':''});
$('#fm_main_r').css({'display':''});
} if(hp < 8) {
hp = 8;
if($('#chat').css('display') != 'none') {
$('#chat').css({'display':'none'});
$('#send_btns_h').css({'display':'none'});
$('#send_btns_h2').css({'display':''});
$('#online').css({'display':'none'});
$('#vline').css({'display':'none'});
GameEngine.timeStempReflesh();
}
if($('#fm_main').css('display') == 'none'){
$('#fm_main').css({'display':'none'});
$('#fm_main_l').css({'display':'none'});
$('#fm_main_r').css({'display':'none'});
}
$('#fm_chat_online').height('1px');
}else if($('#chat').css('display') == 'none'){
$('#chat').css({'display':''});
$('#online').css({'display':''});
$('#vline').css({'display':''});
$('#send_btns_h').css({'display':''});
$('#send_btns_h2').css({'display':'none'});
}
if($('#chat').css('display') != 'none'){
$('#fm_main').height((100-hp)+'%');
$('#fmain').height(($('#fm_main').height()-13)+'px');
}else{
$('#fm_main').height((100-hp)+'%');
$('#fmain').height(($('#fm_main').height()+13)+'px');
}
if($('#chat').css('display') != 'none'){
if($.browser.msie) {
//Этот неловкий момент когда понимаешь что пользователь сидит с IE
var ie_h = 0;
if($('#fm_main').css('display') == 'none'){
ie_h = 16;
}
$('#fm_chat_online').height(( (100-($('#fm_main').height()+55+ie_h)/$(window).height()*100) )+'%');
}else{
$('#fm_chat_online').height(( Math.ceil(100-($('#fm_main').height()+55+4)/$(window).height()*100) )+'%');
}
$('#online_list').height(($('#fm_chat_online').height()-0)+'px');
$('#chat_list').height(($('#fm_chat_online').height()-0)+'px');
}
delete hp;
}
if(this.v[1] == 1) {
//vline
var vp = Math.floor(($('#chat_online').width()-$('#vline').offset().left+15)/$('#chat_online').width()*100);
if(vp < 99 && vp > 1) {
$('#online').width('0%');
$('#chat').width('0%');
$('#chat_list').width('1px');
$('#online_list').width('1px');
$('#chat').width((100-vp)+'%');
$('#online_list').width(($('#online').width()-0)+'px');
$('#chat_list').width(($('#chat').width()-0)+'px');
}
delete vp;
}
this.resetHVLine();
},
startHline:function() {
if(this.v[0] == 0) {
//включаем подставной блок
$('#bline').css({'display':'block'});
$('#bline').unbind('mousemove');
$('#bline').mousemove(function(e) {
$('#hline').css({
'top':(e.pageY - $('#bline').offset().top)+'px'
});
top.ReLine.goHVLine(e);
});
this.v[0] = 1;
}else{
this.stopHline();
}
chat.testScrollMessages();
},
stopHline:function(e) {
//выключаем подставной блок
$('#bline').css({'display':'none'});
$('#bline').unbind('mousemove');
this.goHVLine(e);
this.v[0] = 0;
chat.testScrollMessages();
},
startVline:function() {
if(this.v[1] == 0) {
//включаем подставной блок
$('#bline').css({'display':'block'});
$('#bline').unbind('mousemove');
$('#bline').mousemove(function(e) {
$('#vline').css({
'left':(e.pageX - $('#bline').offset().left)+'px'
});
top.ReLine.goHVLine(e);
});
this.v[1] = 1;
}else{
this.stopVline();
}
},
stopVline:function(e) {
//выключаем подставной блок
$('#bline').css({'display':'none'});
$('#bline').unbind('mousemove');
this.goHVLine(e);
this.v[1] = 0;
},
rebase:function() {
chat.testScrollMessages();
//сброс фреймов
var hp = Math.floor(($(window).height()-$('#hline').offset().top+25)/$(window).height()*100);
$('#fm_main').height('0%');
$('#fmain').height('0%');
$('#fm_chat_online').height('0%');
$('#chat_list').height('1px');
$('#canals').height('1px');
$('#online_list').height('1px');
if(hp > 97) {
if($('#fm_main').css('display') != 'none') {
$('#fm_main').css({'display':'none'});
$('#fm_main_l').css({'display':'none'});
$('#fm_main_r').css({'display':'none'});
}
if($('#chat').css('display') == 'none'){
$('#chat').css({'display':''});
$('#online').css({'display':''});
$('#vline').css({'display':''});
$('#send_btns_h').css({'display':''});
$('#send_btns_h2').css({'display':'none'});
}
hp = 100;
}else if($('#fm_main').css('display') == 'none'){
$('#fm_main').css({'display':''});
$('#fm_main_l').css({'display':''});
$('#fm_main_r').css({'display':''});
} if(hp < 8) {
hp = 8;
if($('#chat').css('display') != 'none') {
$('#chat').css({'display':'none'});
$('#send_btns_h').css({'display':'none'});
$('#send_btns_h2').css({'display':''});
$('#online').css({'display':'none'});
$('#vline').css({'display':'none'});
GameEngine.timeStempReflesh();
}
if($('#fm_main').css('display') == 'none'){
$('#fm_main').css({'display':'none'});
$('#fm_main_l').css({'display':'none'});
$('#fm_main_r').css({'display':'none'});
}
$('#fm_chat_online').height('1px');
}else if($('#chat').css('display') == 'none'){
$('#chat').css({'display':''});
$('#online').css({'display':''});
$('#vline').css({'display':''});
$('#send_btns_h').css({'display':''});
$('#send_btns_h2').css({'display':'none'});
}
if($('#chat').css('display') != 'none'){
$('#fm_main').height((100-hp)+'%');
$('#fmain').height(($('#fm_main').height()-13)+'px');
}else{
$('#fm_main').height((100-hp)+'%');
$('#fmain').height(($('#fm_main').height()+13)+'px');
}
if($('#chat').css('display') != 'none'){
if($.browser.msie) {
//Этот неловкий момент когда понимаешь что пользователь сидит с IE
var ie_h = 0;
if($('#fm_main').css('display') == 'none'){
ie_h = 16;
}
$('#fm_chat_online').height(( (100-($('#fm_main').height()+55+ie_h+6)/$(window).height()*100) )+'%');
}else{
$('#fm_chat_online').height(( Math.ceil(100-($('#fm_main').height()+55+4)/$(window).height()*100) )+'%');
}
$('#online_list').height(($('#fm_chat_online').height()-0)+'px');
$('#chat_list').height(($('#fm_chat_online').height()-0)+'px');
}
}
};
File diff suppressed because it is too large Load Diff
+65
View File
@@ -0,0 +1,65 @@
var Chat = {
socket:false,
start:function() {
Chat.socket = io.connect('http://' + cfg.host + ':8888');
//
var name = '[login]_' + (Math.round(Math.random() * 10000));
var messages = $("#canal0");
var message_txt = $("#msg_text")
$('.chat .nick').text(name);
function msg(nick, message) {
var m = '<div class="msg">' +
'<span class="user"><b>' + safe(nick) + '</b>:</span> '
+ safe(message) +
'</div>';
messages
.append(m)
.scrollTop(messages[0].scrollHeight);
}
function msg_system(message) {
var m = '<div class="msg system">' + safe(message) + '</div>';
messages
.append(m)
.scrollTop(messages[0].scrollHeight);
}
Chat.socket.on('connecting', function () {
msg_system('Соединение...');
});
Chat.socket.on('connect', function () {
msg_system('Соединение установлено!');
});
Chat.socket.on('message', function (data) {
msg( data.name , data.message);
message_txt.focus();
});
$("#btn1c").click(function () {
top.Chat.formSendMessage();
});
function safe(str) {
return str.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
},
testKeyPress:function(e) {
if(event.keyCode==10 || event.keyCode==13) {
this.formSendMessage();
}
},
formSendMessage:function() {
var text = $("#msg_text").val();
var name = User.login;
if (text.length <= 0)
return;
$("#msg_text").val('')
this.socket.emit("message", { message: text, name: name });
}
};
+5
View File
@@ -0,0 +1,5 @@
var core = {
begin:function() {
//$(document.body).html( '' );
}
};
+12
View File
File diff suppressed because one or more lines are too long
+6
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
View File
File diff suppressed because one or more lines are too long
+141
View File
@@ -0,0 +1,141 @@
jQuery.fn.extend({
everyTime: function(interval, label, fn, times, belay) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, times, belay);
});
},
oneTime: function(interval, label, fn) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, 1);
});
},
stopTime: function(label, fn) {
return this.each(function() {
jQuery.timer.remove(this, label, fn);
});
}
});
jQuery.extend({
timer: {
guid: 1,
global: {},
regex: /^([0-9]+)\s*(.*s)?$/,
powers: {
// Yeah this is major overkill...
'ms': 1,
'cs': 10,
'ds': 100,
's': 1000,
'das': 10000,
'hs': 100000,
'ks': 1000000
},
timeParse: function(value) {
if (value == undefined || value == null)
return null;
var result = this.regex.exec(jQuery.trim(value.toString()));
if (result[2]) {
var num = parseInt(result[1], 10);
var mult = this.powers[result[2]] || 1;
return num * mult;
} else {
return value;
}
},
add: function(element, interval, label, fn, times, belay) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times)
times = fn;
fn = label;
label = interval;
}
interval = jQuery.timer.timeParse(interval);
if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
return;
if (times && times.constructor != Number) {
belay = !!times;
times = 0;
}
times = times || 0;
belay = belay || false;
if (!element.$timers)
element.$timers = {};
if (!element.$timers[label])
element.$timers[label] = {};
fn.$timerID = fn.$timerID || this.guid++;
var handler = function() {
if (belay && this.inProgress)
return;
this.inProgress = true;
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
jQuery.timer.remove(element, label, fn);
this.inProgress = false;
};
handler.$timerID = fn.$timerID;
if (!element.$timers[label][fn.$timerID])
element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
if ( !this.global[label] )
this.global[label] = [];
this.global[label].push( element );
},
remove: function(element, label, fn) {
var timers = element.$timers, ret;
if ( timers ) {
if (!label) {
for ( label in timers )
this.remove(element, label, fn);
} else if ( timers[label] ) {
if ( fn ) {
if ( fn.$timerID ) {
window.clearInterval(timers[label][fn.$timerID]);
delete timers[label][fn.$timerID];
}
} else {
for ( var fn in timers[label] ) {
window.clearInterval(timers[label][fn]);
delete timers[label][fn];
}
}
for ( ret in timers[label] ) break;
if ( !ret ) {
ret = null;
delete timers[label];
}
}
for ( ret in timers ) break;
if ( !ret )
element.$timers = null;
}
}
}
});
if (jQuery.browser.msie)
jQuery(window).one("unload", function() {
var global = jQuery.timer.global;
for ( var label in global ) {
var els = global[label], i = els.length;
while ( --i )
jQuery.timer.remove(els[i], label);
}
});
+40
View File
@@ -0,0 +1,40 @@
//This script detects the following:
//Flash
//Windows Media Player
//Java
//Shockwave
//RealPlayer
//QuickTime
//Acrobat Reader
//SVG Viewer
var agt=navigator.userAgent.toLowerCase();
var ie = (agt.indexOf("msie") != -1);
var ns = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
if (ie && win) { pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }
if (ns || !win) {
nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");
}
function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }
pluginlist += navigator.javaEnabled() ? "Java," : "";
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
//SAMPLE USAGE- detect "Flash"
//if (pluginlist.indexOf("Flash")!=-1)
//document.write("You have flash installed")
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
+159
View File
@@ -0,0 +1,159 @@
var u = {
wName:{
0:['неизвестно',20,20],
1:['серьги',60,20],
2:['ожерелье'],
3:['оружие'],
4:['броня'],
5:['slot5'],
6:['slot6'],
7:['кольцо'],
8:['кольцо'],
9:['кольцо'],
10:['шлем'],
11:['slot11'],
12:['перчатки'],
13:['обувь'],
14:['щит']
},
userHealthData:{},
userHealth:function( timeStart , hp , mp , hpAll , mpAll , minHP , minMP , block ) {
var html = '';
/*
if( timeStart == 0 ) {
timeStart = GameEngine.timenow();
}
*/
//Проверяем сколкьо НР и МР на данный момент
var timeLast = GameEngine.timenow()-timeStart;
timeStart = GameEngine.timenow();
GameEngine.c( hp );
hp += hpAll/100*((timeLast/(minHP*60))*100);
//
if( hp > hpAll ) {
hp = hpAll;
}else if( hp < 0 ) {
hp = 0;
}
if( $(block) != undefined && hp < hpAll ) {
clearTimeout(this.userHealthData[$(block).attr('id')]);
this.userHealthData[$(block).attr('id')] = setTimeout(function(){ u.userHealth( timeStart , hp , mp , hpAll , mpAll , minHP , minMP , block ); },500);
}
var hpl = Math.floor( Math.floor(hp) / Math.floor(hpAll) * 100 );
var hpr = 100-hpl;
html += '<table border="0" cellspacing="0" cellpadding="0">'+
'<tr height="10">'+
'<td width="14"><img class="wib" src="/static/images/herz.gif" width="10" height="9"></td>'+
'<td width="150">';
//
if( hpl < 33 ) {
html += '<img class="wib" src="/static/images/1red.gif" width="' + hpl + '%" height="10">';
}else if( hpl < 66 ) {
html += '<img class="wib" src="/static/images/1yellow.gif" width="' + hpl + '%" height="10">';
}else{
html += '<img class="wib" src="/static/images/1green.gif" width="' + hpl + '%" height="10">';
}
//
html += '<img class="wib" src="/static/images/1silver.gif" width="' + hpr + '%" height="10">'+
//
'</td>'+
'<td>:&nbsp;' + Math.floor(hp) + '/' + hpAll + '</td>'+
'</tr>'+
'<tr>'+
'<td></td>'+
'<td></td>'+
'<td></td>'+
'</tr>'+
'</table>';
if( block != null ) {
$(block).html( html );
}else{
return html;
}
},
userInfoLogin:function( id , login , level , align , clan ) {
var html = '';
html += '<b>' + login + '</b> [' + level + ']';
html += '<a href="/userinfo/' + id + '" target="_blank"><img src="/static/images/inf.gif" width="12" height="11"></a>';
return html;
},
userInformation:function( data , block ) {
/*
0 - id
1 - логин
2 - уровень
3 - пол
4 - образ
5 - склонность
6 - клан
7 - предметы на персонаже
*/
var html = '';
html += '<div align="center">' + this.userInfoLogin( data[0] , data[1] , data[2] , data[4] , data[5] ) + '</div>';
html += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="top">';
html += '<div id="hpblock' + data[0] + '"></div>';
html += '<div class="ws_border">';
html += '<div class="w_l">';
//
html += this.wDisplay( data[7] , 1 );
html += this.wDisplay( data[7] , 2 );
html += this.wDisplay( data[7] , 3 );
html += this.wDisplay( data[7] , [ 4 , 5 , 6 ] );
html += this.wDisplay( data[7] , 7 );
html += this.wDisplay( data[7] , 8 );
html += this.wDisplay( data[7] , 9 );
//
html += '</div>';
//
html += '<div class="w_c">';
//
html += this.oDisplay( data[5] , 0 );
//
html += '</div>';
//
html += '<div class="w_l">';
//
html += this.wDisplay( data[7] , [ 10 , 11 ] );
html += this.wDisplay( data[7] , 12 );
html += this.wDisplay( data[7] , 14 );
html += this.wDisplay( data[7] , 13 );
//
html += '</div>';
html += '</div>';
html += '</td></tr></table>';
if( html == '' ) {
html = '<div align="center">Undefined data</div>';
}
$(block).html( html );
//Запускаем реген НР \ МР
this.userHealth( data[8][0] , data[8][1] , data[8][3] , data[8][2] , data[8][4] , data[8][5] , data[8][6] , $(block).find('#hpblock' + data[0] + '') );
},
wDisplay:function( itm , w ) {
var html = '';
if( html == '' ) {
if( typeof w == 'object' ) {
w = w[0];
}
html = '<img title="Пустой слот ' + this.wName[w][0] + '" class="wi" width="' + this.wName[w][1] + '" height="' + this.wName[w][2] + '" src="/static/images/items/w/w' + w + '.gif">';
}
return html;
},
oDisplay:function( img , sex ) {
var html = '';
html += '<img width="76" height="209" src="/static/images/chars/' + sex + '/' + img + '">';
return html;
}
};
+174
View File
@@ -0,0 +1,174 @@
var key_actions = {};
function mousePageXY(e)
{
var x = 0, y = 0;
if (e.pageX || e.pageY)
{
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
return {"x":x, "y":y};
}
function unpx(v)
{
if( v != undefined ) {
return Number(v.replace('px',''));
}
}
//РћРєРЅР°
var wind = {
winc:{}, //координаты окон
wsdr:null,
scor:{}, //начальные координаты
openw:function(id,title,text,date,type,style)
{
if($('#win_'+id).attr('id')==undefined)
{
//Создаем новое окно
this.add(id,title,text,date,type,1,'');
}
},
WstartDrag:function(id)
{
$('#wupbox').css({'display':'block','cursor':'move'});
this.wsdr = id;
$('.w1').css({'z-index':1102});
$('#win_'+id).css({'z-index':1103});
delete cm;
},
WmoveDrag:function(e)
{
//Сохраняем начальные координаты
var x = mousePageXY(e)['x'],y = mousePageXY(e)['y'];
if(this.scor.x==undefined)
{
this.scor.x = x;
this.scor.y = y;
this.scor.x2 = unpx($('#win_'+this.wsdr).css('left'));
this.scor.y2 = unpx($('#win_'+this.wsdr).css('top'));
}
x = x-this.scor.x;
y = y-this.scor.y;
x += this.scor.x2;
y += this.scor.y2;
if(x < 9){ x = 9; }
if(x + $('#win_'+this.wsdr).width() > $(window).width() - 9 ){ x = $(window).width() - 9 - $('#win_'+this.wsdr).width(); }
if(y<35){ y = 35; }
if(y + $('#win_'+this.wsdr).height() > $(window).height() - 35 ){ y = $(window).height() - 35 - $('#win_'+this.wsdr).height(); }
$('#win_'+this.wsdr).css({'top':y+'px','left':x+'px'});
},
WstopDrag:function()
{
$('#wupbox').css({'display':'none','cursor':'move'});
this.wsdr = null;
this.scor = {};
},
add:function(id,title,text,date,type,style,css)
{
var nw = '';
if($('#win_'+id).attr('id') == undefined)
{
var acts = {};
if(date.usewin != undefined)
{
acts[0] = 'onmouseup="'+date.usewin+'"';
}
//нижняя часть
if(date.n != undefined)
{
text += '<div style="margin-left:4px;">'+date.n+'</div>';
}
var kyps = ['',''];
//Вывод главных данных
if(type==0)
{
nw = text;
}else if(type==1)
{
//Просто вывод данных
nw = text;
}else if(type==2)
{
//Да \ Нет
nw = '<div>'+text+'</div><div style="padding:5px"><div style="float:left"><button onClick="'+date.a1+';wind.closew(\''+id+'\');" style="width:100px">Да</button></div><div style="float:right"><button onClick="wind.closew(\''+id+'\')" style="width:100px">Нет</button></div><br></div>';
kyps[0] = ''+date.a1+';top.wind.closew(\\\''+id+'\\\');top.wind.addaction(0,\\\'\\\');';
}else if(type==3)
{
//Да \ Нет , изображения
nw = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>'+text+'</td><td width="40" align="center" valign="middle"><img style="margin-top:5px;cursor:pointer" onClick="'+date.a1+';wind.closew(\''+id+'\');" src="http://'+cfg.img+'/i/b__ok.gif" width="25" height="18"><br><img onClick="wind.closew(\''+id+'\')" style="cursor:pointer" src="http://'+cfg.img+'/i/b__cancel.jpg" width="25" height="18"></td></tr></table>';
kyps[0] = ''+date.a1+';top.wind.closew(\\\''+id+'\\\');top.wind.addaction(0,\\\'\\\');';
}else if(type==4)
{
//Тройной блок
nw = text[0];
}
//Если есть вторая информация
if(date.d!=undefined)
{
nw = nw+date.d;
}
nw = '<div style="margin:2px;'+css+'">'+nw+'</div>';
//Заголовок окна
if(title != '')
{
nw = '<div class="wi'+style+'s10" onselectstart="return false">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td style="cursor:move" onmousedown="wind.WstartDrag(\''+id+'\')" '+acts[0]+'><b>'+title+'</b></td>'+
'<td width="15" align="right"><img style="display:block" onClick="wind.closew(\''+id+'\')" src="http://'+cfg.img+'images/clear.gif" width="13" height="13"></td>'+
'</tr>'+
'</table>'+
'</div>'+nw;
}
//Собираем каркас
nw = '<table onclick="top.wind.addaction(0,\''+kyps[0]+'\')" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td class="wi'+style+'s0"></td>'+
'<td class="wi'+style+'s1"></td>'+
'<td class="wi'+style+'s2"></td>'+
'</tr>'+
'<tr>'+
'<td class="wi'+style+'s3"><img src="http://'+cfg.img+'/1x1.gif" width="5" height="1"></td>'+
'<td class="wi'+style+'s7" id="win_main_'+id+'">'+nw+'</td>'+
'<td class="wi'+style+'s4"><img src="http://'+cfg.img+'/1x1.gif" width="5" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td class="wi'+style+'s5"></td>'+
'<td class="wi'+style+'s6"></td>'+
'<td class="wi'+style+'s8"><div id="win_a_'+id+'" class="wi'+style+'s9"></div></td>'+
'</tr>'+
'</table>';
//Вешаем окно
nw = '<div class="w1" '+acts[0]+' id="win_'+id+'">'+nw+'</div>';
$('#windows').html($('#windows').html()+nw);
$('#win_'+id).center();
if(type == 2 || type == 3) {
}
}
delete nw;
},
addaction:function(nm,vl) {
top.key_actions[nm] = vl;
if(nm != 2) {
top.key_actions[2] = 1;
}
},
closew:function(id)
{
$('#win_'+id).html('');
$('#win_'+id).remove();
}
}