mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Markdown
* added [money ..] and [currency=] to tag parser * added missing styles to properly display [quote ..] and diffs * added missing js to display [n5 ..] and progress bars
This commit is contained in:
@@ -16799,6 +16799,129 @@ function g_getProfileRealmUrl(profile) {
|
||||
return '?profiles=' + profile.region + '.' + profile.realm;
|
||||
}
|
||||
|
||||
var ProgressBar = function(opt)
|
||||
{
|
||||
this.opts = {
|
||||
text: '',
|
||||
hoverText: '',
|
||||
color: 'rep6',
|
||||
width: 0,
|
||||
progress: 0
|
||||
};
|
||||
|
||||
this.elements = {
|
||||
text: null,
|
||||
hoverText: null,
|
||||
textContainer: null,
|
||||
progress: null,
|
||||
container: null
|
||||
};
|
||||
|
||||
$WH.cO(this.opts, opt);
|
||||
|
||||
this.build();
|
||||
};
|
||||
|
||||
ProgressBar.prototype.build = function()
|
||||
{
|
||||
var el = $('<a/>', { 'class': 'progressbar', href: 'javascript:;' });
|
||||
if(this.opts.width > 0)
|
||||
el.css('width', this.opts.width + 'px');
|
||||
else
|
||||
el.css('width', 'auto');
|
||||
|
||||
var textDiv = $('<div/>', { 'class': 'progressbar-text' });
|
||||
if(this.opts.text)
|
||||
{
|
||||
this.elements.text = $('<del/>', { text: this.opts.text });
|
||||
textDiv.append(this.elements.text);
|
||||
}
|
||||
if(this.opts.hoverText)
|
||||
{
|
||||
this.elements.hoverText = $('<ins/>', { text: this.opts.hoverText });
|
||||
textDiv.append(this.elements.hoverText);
|
||||
}
|
||||
el.append(textDiv);
|
||||
|
||||
var div = $('<div/>', { 'class': 'progressbar-' + this.opts.color, css: { width: this.opts.progress + '%' }, text: String.fromCharCode(160) });
|
||||
el.append(div);
|
||||
|
||||
if(this.opts.text)
|
||||
textDiv.append($('<div/>', { 'class': 'progressbar-text progressbar-hidden', text: this.opts.text }));
|
||||
|
||||
this.elements.container = el;
|
||||
this.elements.progress = div;
|
||||
this.elements.textContainer = textDiv;
|
||||
|
||||
return el;
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setText = function(text)
|
||||
{
|
||||
this.opts.text = text;
|
||||
|
||||
if(this.elements.text)
|
||||
this.elements.text.text(this.opts.text);
|
||||
else
|
||||
{
|
||||
this.elements.text = $('<del/>', { text: this.opts.text });
|
||||
if(this.opts.hoverText)
|
||||
this.opts.hoverText.before(this.elements.text);
|
||||
else
|
||||
this.elements.textContainer.append(this.elements.text);
|
||||
}
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setHoverText = function(text)
|
||||
{
|
||||
this.opts.hoverText = text;
|
||||
|
||||
if(this.elements.hoverText)
|
||||
this.elements.hoverText.text(this.opts.hoverText);
|
||||
else
|
||||
{
|
||||
this.elements.hoverText = $('<ins/>', { text: this.opts.hoverText });
|
||||
this.elements.textContainer.append(this.elements.hoverText);
|
||||
}
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setProgress = function(percent)
|
||||
{
|
||||
this.opts.progress = percent;
|
||||
|
||||
this.elements.progress.css('width', this.opts.progress + '%');
|
||||
};
|
||||
|
||||
ProgressBar.prototype.setWidth = function(width)
|
||||
{
|
||||
this.opts.width = width;
|
||||
|
||||
if(this.opts.width > 0)
|
||||
this.elements.container.css('width', this.opts.width + 'px');
|
||||
else
|
||||
this.elements.container.css('width', 'auto');
|
||||
};
|
||||
|
||||
ProgressBar.prototype.getText = function()
|
||||
{
|
||||
return this.opts.text;
|
||||
};
|
||||
|
||||
ProgressBar.prototype.getHoverText = function()
|
||||
{
|
||||
return this.opts.hoverText;
|
||||
};
|
||||
|
||||
ProgressBar.prototype.getWidth = function()
|
||||
{
|
||||
return this.opts.width;
|
||||
};
|
||||
|
||||
ProgressBar.prototype.getContainer = function()
|
||||
{
|
||||
return this.elements.container;
|
||||
};
|
||||
|
||||
var Icon = {
|
||||
sizes: ['small', 'medium', 'large'],
|
||||
sizes2: [18, 36, 56],
|
||||
@@ -20834,6 +20957,37 @@ $WH.aE(window, 'load', function () {
|
||||
});
|
||||
|
||||
|
||||
function GetN5(num)
|
||||
{
|
||||
var absNum = Math.abs(num);
|
||||
|
||||
if (absNum < 10000) // 1234 = 1,234
|
||||
return $WH.number_format(num);
|
||||
|
||||
if (absNum < 100000) // 12345 = 12.3k
|
||||
return (Math.round(num / 100) / 10) + 'k';
|
||||
|
||||
if (absNum < 1000000) // 123456 = 123k
|
||||
return Math.round(num / 1000) + 'k';
|
||||
|
||||
if (absNum < 10000000) // 1234567 = 1.23m
|
||||
return (Math.round(num / 1000 / 10) / 100) + 'm';
|
||||
|
||||
if (absNum < 100000000) // 12345678 = 12.3m
|
||||
return (Math.round(num / 1000 / 100) / 10) + 'm';
|
||||
|
||||
if (absNum < 1000000000) // 123456789 = 123m
|
||||
return Math.round(num / 1000 / 1000) + 'm';
|
||||
|
||||
if (absNum < 10000000000) // 1234567890 = 1,234,567,890 = 1.23b
|
||||
return (Math.round(num / 1000 / 1000 / 10) / 100) + 'b';
|
||||
|
||||
if (absNum < 10000000000) // 1234567890 = 1,234,567,890 = 1.23b
|
||||
return (Math.round(num / 1000 / 1000 / 100) / 10) + 'b';
|
||||
|
||||
return Math.round(num / 1000 / 1000 / 1000) + 'b';
|
||||
}
|
||||
|
||||
function CreateAjaxLoader() {
|
||||
return $('<img>').attr('alt', '').attr('src', g_staticUrl + '/images/icons/ajax.gif').addClass('ajax-loader');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user