// August Chat System
// Copyright (c) 2000-2012 by August
// www: http://www.august4u.ru/
// file: menu.js
// example of features of extended menu
(function () {
if (!window.AugustMenu) {
if (!arguments.callee.init)
August.menu ()
arguments.callee.init = 1
setTimeout (arguments.callee, 100)
return
}
if (window.AugustMenuExample)
return
window.AugustMenuExample = this
function august_menu_setup () {
august_menu_setup.superclass.constructor.apply (this, arguments)
this.id = "setup"
var Menu = [">Цвет ника", ">Шрифт ника", ">Стиль ника", ">Цвет сообщений", ">Шрифт сообщений", ">Стиль сообщений"]
var Access = [User.Priv [0] & 1, User.Priv [0] & 2, User.Priv [0] & 2, User.Priv [0] & 4, User.Priv [0] & 8, User.Priv [0] & 8]
this.size = function () {
return Menu.length
}
this.item = function ( i ) {
return Access [i] ? Menu [i] : false
}
this.handler = function ( el, i ) {
return new [color, font, style, color, font, style][i]
}
}
function color () {
color.superclass.constructor.apply (this, arguments)
this.id = "color"
var sc = 3
this.html = function () {
var t = []
for (var y = 0; y < sc * 4 + 1; y++) {
var r = []
for (var x = 0; x < sc * 6; x++)
r.push ("
")
r.push (" | ")
t.push (" | " + r.join ("") + "
")
}
return ""
}
this.handler = function ( el ) {
if (el.tagName == "TD")
August.sendCmd (22, "", null, "mess=/setup" + [" nc ", "", "", " mc ", "", ""][this.parent ().m] + el.bgColor)
}
function rgb ( x, y ) {
var c = 256 / sc * (x % sc)
var r = 0, g = 0, b = 0
switch (Math.floor (x / sc)) {
case 0: r = 255; g = c; break
case 1: r = 255 - c; g = 255; break
case 2: g = 255; b = c; break
case 3: g = 255 - c; b = 255; break
case 4: r = c; b = 255; break
case 5: r = 255; b = 255 - c; break
}
if (y < 2 * sc) {
var k = y / sc / 2
r *= k
g *= k
b *= k
} else {
var k = y / sc / 2 - 1
r += (255 - r) * k
g += (255 - g) * k
b += (255 - b) * k
}
return "#" + Math.round (r).hex () + Math.round (g).hex () + Math.round (b).hex ()
}
}
function font () {
font.superclass.constructor.apply (this, arguments)
this.id = "font"
var Fonts = ["Andale Mono", "Arial", "Book Antiqua", "Comic Sans MS", "Courier", "Fixedsys", "Georgia", "Lucida Console", "MS Sans Serif", "MS Serif", "System", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana"]
this.size = function () {
return Fonts.length
}
this.item = function ( i ) {
return Fonts [i]
}
this.handler = function ( el, i ) {
August.sendCmd (22, "", null, "mess=/setup" + ["", " nf ", "", "", " mf ", ""][this.parent ().m] + Fonts [i])
}
}
function style () {
style.superclass.constructor.apply (this, arguments)
this.id = "style"
var Style = ["Прямой", "Наклонный", "Тонкий", "Жирный"]
var Style2 = ["normal", "italic", "thin", "thick"]
this.size = function () {
return Style.length
}
this.item = function ( i ) {
return Style [i]
}
this.handler = function ( el, i ) {
August.sendCmd (22, "", null, "mess=/setup" + ["", "", " ns ", "", "", " ms "][this.parent ().m] + Style2 [i])
}
}
august_extend (august_menu_setup, august_menu_base)
august_extend (color, august_menu_base)
august_extend (font, august_menu_base)
august_extend (style, august_menu_base)
AugustMenu.registerMenu ("setup", "Настройки")
AugustMenu.insertMenu (new august_menu_setup)
}) ()