* 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:
Sarjuuk
2016-08-14 22:45:05 +02:00
parent 2bc40e9421
commit 674a2a7814
8 changed files with 446 additions and 4 deletions

View File

@@ -21,14 +21,37 @@ class Markup
public function parseGlobalsFromText(&$jsg = [])
{
if (preg_match_all('/(?<!\\\\)\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|statistic|title|event|class|race|skill|currency)=(-?\d+)[^\]]*\]/i', $this->text, $matches, PREG_SET_ORDER))
if (preg_match_all('/(?<!\\\\)\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|statistic|title|event|class|race|skill|currency|emote|enchantment|money)=(-?\d+)[^\]]*\]/i', $this->text, $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{
if ($match[1] == 'statistic')
$match[1] = 'achievement';
if ($type = array_search($match[1], Util::$typeStrings))
if ($match[1] == 'money')
{
if (stripos($match[0], 'items'))
{
if (preg_match('/items=([0-9,]+)/', $match[0], $submatch))
{
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i+=2)
$this->jsGlobals[TYPE_ITEM][$sm[$i]] = $sm[$i];
}
}
if (stripos($match[0], 'currency'))
{
if (preg_match('/currency=([0-9,]+)/', $match[0], $submatch))
{
$sm = explode(',', $submatch[1]);
for ($i = 0; $i < count($sm); $i+=2)
$this->jsGlobals[TYPE_CURRENCY][$sm[$i]] = $sm[$i];
}
}
}
else if ($type = array_search($match[1], Util::$typeStrings))
$this->jsGlobals[$type][$match[2]] = $match[2];
}
}

View File

@@ -87,8 +87,9 @@ class EventPage extends GenericPage
/* Main Content */
/****************/
if ($this->hId)
$this->extraText = Util::jsEscape($this->subject->getField('description', true));
// no entry in ?_articles? use default HolidayDescription
if ($this->hId && empty($this->article))
$this->article = ['text' => Util::jsEscape($this->subject->getField('description', true)), 'params' => []];
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(

View File

@@ -150,6 +150,267 @@ h5 a.icontiny span { text-decoration:none !important; }
overflow:auto;
}
.quote-blizz,.quote-wh
{
clear:both;
}
.quote-blizz h1,.quote-wh h1,.quote-blizz h2,.quote-wh h2,.quote-blizz h3,.quote-wh h3,.quote-blizz h4,.quote-wh h4
{
border:none;
line-height:1.2;
padding:0;
}
.quote-blizz h1,.quote-wh h1
{
margin:25px 0 15px 0;
line-height:1;
}
.quote-blizz h2,.quote-wh h2
{
margin:15px 0 10px 0;
}
.quote-blizz h3,.quote-wh h3
{
margin:10px 0 7px 0;
}
.quote-blizz h4,.quote-wh h4
{
margin:8px 0 5px 0;
}
.quote-blizz ul,.quote-blizz ol,.quote-wh ul,.quote-wh ol
{
margin-top:10px;
}
.quote-header
{
padding:15px 0 0 15px;
line-height:1;
position:relative;
font-size:13px;
}
.collapse .quote-body
{
display:none;
}
.quote-header a
{
font-size:10px;
text-decoration:none!important;
}
.quote-header h2,.quote-header h2 a
{
background:none!important;
text-shadow:0 1px 1px #000;
color:#fff!important;
margin:15px 0 0 0;
}
.quote-header h2 a:hover
{
color:#fff;
}
.quote-body
{
padding:10px 15px 0 15px;
-moz-border-radius:0 0 10px 0;
-webkit-border-radius:0 0 10px 0;
border-radius:0 0 10px 0;
}
.quote-blizz
{
background:#13181e url(../images/blog/bluepost-bg.png) left top no-repeat;
color:#00c0ff;
}
.quote-blizz .quote-header a
{
color:#BEF;
font-size:13px;
}
.quote-blizz .quote-header a:hover
{
color:#FFF;
}
.quote-blizz .quote-body a,.quote-blizz .quote-body .q1 a
{
color:#bef;
}
.quote-blizz .quote-body a:hover,.quote-blizz quote-body .q1 a:hover
{
color:#fff!important;
}
.quote-blizz .quote-body a b
{
color:#bef!important;
text-decoration:none;
}
.quote-blizz .quote-body a:hover b
{
color:#fff!important;
}
.quote-blizz .quote-body b a
{
text-decoration:none;
}
.quote-blizz hr
{
background:transparent;
border-top:1px dotted #333;
height:1px;
margin:5px 0 10px 0;
}
.quote-wh
{
/* background:#1e1e1e url(../images/blog/whpost-bg.png) left top no-repeat; */
position:relative;
color:#ccc;
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
border:solid 2px #bbb;
margin:15px;
clear:both;
min-height:24px;
}
.quote-wh .quote-header a
{
color:#ffcd55;
text-shadow:0 -1px 0 #13181e;
background:url(../images/blog/wh-link.png) right center no-repeat;
}
.quote-wh .quote-header a:hover
{
color:#fff;
}
.quote-wh .quote-body
{
background:none;
}
.quote-wh .quote-body a
{
color:#ffd100;
}
.quote-body .c3
{
color:#AAD372!important;
}
.quote-body .c4
{
color:#FFF468!important;
}
.quote-body .c5,.quote-body .q1
{
color:#fff!important;
}
.quote-body .c8
{
color:#68CCEF!important;
}
.quote-body h1,.quote-body h2,.quote-body h3,.quote-body h4,.quote-body h5
{
color:#fff;
}
.quote-body li
{
background:none!important;
list-style-type:disc;
padding-left:0!important;
}
div.secheader
{
background-color:#1e1e1e;
color:#fff;
border:solid 2px #bbb;
border-width:2px 0;
margin:15px 0;
padding:5px 0 6px 8px;
clear:both;
-moz-box-shadow:0 1px 13px #000,0 0 3px #000 inset;
font-size:22px;
}
a.revealtoggle
{
text-decoration:none;
}
.quote-header a.toggle,.quote-wh a.toggle
{
position:absolute;
top:15px;
right:18px;
display:block;
width:51px;
height:11px;
line-height:11px;
color:#888!important;
background:transparent url(../images/blog/quote-toggle.png) no-repeat!important;
background-position:0 -11px!important;
padding:0 0 0 10px;
text-align:right;
text-decoration:none!important;
}
.quote-wh a.toggle
{
top:12px;
}
.collapse .quote-header a.toggle,.collapse a.toggle
{
color:#fff!important;
background-position:0 0!important;
width:46px;
}
.collapse .quote-header a.toggle
{
right:15px;
top:auto;
bottom:0;
}
.collapse .quote-header
{
padding-right:81px;
}
.quote-wh.collapse
{
padding-top:18px;
}
/**************************************************************/
/* CSS BELOW TO BE MOVED TO A PROPER LOCATION AND/OR REFACTOR */
/**************************************************************/
@@ -2957,6 +3218,9 @@ td.screenshot-cell:hover img {
margin-bottom: 0 !important;
}
del.diffmod, del.diffdel { opacity: 0.40; filter: alpha(opacity=40); text-decoration: none; border-bottom: 1px dotted; }
ins.diffmod, ins.diffins { color: #5DF644; text-decoration: none; border-bottom: 1px dotted; }
/*
Reusable UI elements/features
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -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');
}