- implemented factions basics (search, listview and details)

- added forgotten shared brick for tooltips
This commit is contained in:
Sarjuuk
2014-01-22 10:32:31 +01:00
parent c7c6028adf
commit 91ecc21e8c
26 changed files with 784 additions and 197 deletions

View File

@@ -0,0 +1,28 @@
{strip}
new Listview({ldelim}
template:'faction',
{if !isset($params.id)}id:'factions',{/if}
{if !isset($params.name)}name:LANG.tab_factions,{/if}
{if !isset($params.parent)}parent:'lv-generic',{/if}
{foreach from=$params key=k item=v}
{if $v[0] == '$'}
{$k}:{$v|substr:1},
{else if $v}
{$k}:'{$v}',
{/if}
{/foreach}
data:[
{foreach name=i from=$data item=curr}
{ldelim}
{foreach from=$curr key='name' item=val}
{if $name != 'id'}
{$name}:{$val|@json_encode:$smarty.const.JSON_NUMERIC_CHECK},
{/if}
{/foreach}
id:{$curr.id}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}
{/foreach}
]
{rdelim});
{/strip}

View File

@@ -1,3 +1,24 @@
{if !empty($tab.showRep)}
var _ = [
{ldelim}
id: 'standing',
after: 'reqlevel',
name: LANG.standing,
width: '12%',
value: 'standing',
type: 'text',
getValue: function(item)
{ldelim}
return g_reputation_standings[item.standing];
{rdelim},
compute: function(item, td)
{ldelim}
return g_reputation_standings[item.standing];
{rdelim}
{rdelim}
];
{/if}
{strip}
new Listview({ldelim}
template:'item',

View File

@@ -1,3 +1,16 @@
{if !empty($tab.showRep)}
var _ = [
{ldelim}
id: 'reputation',
after: 'rewards',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
{rdelim}
];
{/if}
{strip}
new Listview({ldelim}
template:'quest',
@@ -14,62 +27,12 @@
data:[
{foreach name=i from=$data item=curr}
{ldelim}
id:'{$curr.id}',
name:'{$curr.name|escape:"quotes"}',
level:'{$curr.level}',
{if isset($curr.reqlevel)}
reqlevel:{$curr.reqlevel},
{/if}
{if isset($curr.reqclass)}
reqclass:{$curr.reqclass},
{/if}
{if isset($curr.reqrace)}
reqrace:{$curr.reqrace},
{/if}
side:'{$curr.side}'
{if isset($curr.itemrewards)}
,itemrewards:[
{section name=j loop=$curr.itemrewards}
[{$curr.itemrewards[j][0]},{$curr.itemrewards[j][1]}]
{if $smarty.section.j.last}{else},{/if}
{/section}
]
{/if}
{if isset($curr.itemchoices)}
,itemchoices:[
{section name=j loop=$curr.itemchoices}
[{$curr.itemchoices[j][0]},{$curr.itemchoices[j][1]}]
{if $smarty.section.j.last}{else},{/if}
{/section}
]
{/if}
{if $curr.xp}
,xp:{$curr.xp}
{/if}
{if isset($curr.titlereward)}
,titlereward:{$curr.titlereward}
{/if}
{if isset($curr.money)}
,money:{$curr.money}
{/if}
{if isset($curr.category)}
,category:{$curr.category}
{/if}
{if isset($curr.category2)}
,category2:{$curr.category2}
{/if}
{if isset($curr.type)}
,type:{$curr.type}
{/if}
{if isset($curr.daily)}
,daily:1
{/if}
{if isset($curr.weekly)}
,weekly:1
{/if}
{if $curr.wflags}
,wflags:{$curr.wflags} {* wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) *}
{/if}
{foreach from=$curr key='name' item=val}
{if $name != 'id'}
{$name}:{$val|@json_encode:$smarty.const.JSON_NUMERIC_CHECK},
{/if}
{/foreach}
id:{$curr.id}
{rdelim}
{if $smarty.foreach.i.last}{else},{/if}
{/foreach}

View File

@@ -0,0 +1,28 @@
<div id="ic{$page.typeId}" style="float: left"></div>
<div id="tt{$page.typeId}" class="tooltip" style="float: left; padding-top: 1px"></div>
<div style="clear: left"></div>
<div id="sl{$page.typeId}" style="margin-left: 70px; margin-top: 4px;"></div>
<div id="ks{$page.typeId}" style="margin-left: 70px; margin-top: 4px;"></div>
{if !empty($jsGlobals[6][2].buff)} {* not set with items *}
<h3>{$lang._aura}</h3>
<div id="btt{$page.typeId}" class="tooltip"></div>
{/if}
<script type="text/javascript">//<![CDATA[
$WH.ge('ic{$page.typeId}').appendChild(Icon.create('{$lvData.page.icon}', 2, null, 0, {$lvData.page.stack}));
var
tt = $WH.ge('tt{$page.typeId}'),
{if !empty($jsGlobals[6][2].buff)}
btt = $WH.ge('btt{$page.typeId}'),
{/if}
sl = $WH.ge('sl{$page.typeId}'),
ks = $WH.ge('ks{$page.typeId}');
tt.innerHTML = '<table><tr><td>' + ($WH.g_enhanceTooltip.bind(tt))({$page.typeId}, true, true, sl, null, [{$page.typeId}], ks, null) + '</td><th style="background-position: top right"></th></tr><tr><th style="background-position: bottom left"></th><th style="background-position: bottom right"></th></tr></table>';
$WH.Tooltip.fixSafe(tt, 1, 1);
{if !empty($jsGlobals[6][2].buff)}
btt.innerHTML = '<table><tr><td>' + ($WH.g_enhanceTooltip.bind(btt))({$page.typeId}, true, true, sl, tt, [{$page.typeId}], ks) + '</td><th style="background-position: top right"></th></tr><tr><th style="background-position: bottom left"></th><th style="background-position: bottom right"></th></tr></table>';
$WH.Tooltip.fixSafe(btt, 1, 1);
{/if}
//]]></script>

51
template/faction.tpl Normal file
View File

@@ -0,0 +1,51 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">//<![CDATA[
{include file='bricks/community.tpl'}
var g_pageInfo = {ldelim}type: {$page.type}, typeId: {$page.typeId}, name: '{$lvData.page.name|escape:"quotes"}'{rdelim};
g_initPath({$page.path});
//]]></script>
{include file='bricks/infobox.tpl' info=$lvData.infobox}
<div class="text">
{include file='bricks/redButtons.tpl'}
<h1>{$lvData.page.name}</h1>
{include file='bricks/article.tpl'}
{if $lvData.spillover}
<div id="spillover" class="left"></div>
<script type="text/javascript">//<![CDATA[
Markup.printHtml("{$lvData.spillover}", "spillover", {strip}{ldelim}
allow: Markup.CLASS_ADMIN,
dbpage: true
{rdelim}{/strip});
//]]></script>
<div class="pad2"></div>
{/if}
<h2 class="clear">{$lang.related}</h2>
</div>
{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs}
{include file='bricks/contribute.tpl'}
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

20
template/factions.tpl Normal file
View File

@@ -0,0 +1,20 @@
{include file='header.tpl'}
<div id="main">
<div id="main-precontents"></div>
<div id="main-contents" class="main-contents">
<script type="text/javascript">
g_initPath({$page.path});
</script>
<div id="lv-factions" class="listview"></div>
<script type="text/javascript">
{include file='bricks/factions_table.tpl' data=$factions.data params=$factions.params}
</script>
<div class="clear"></div>
</div>
</div>
{include file='footer.tpl'}

View File

@@ -507,7 +507,7 @@ var Markup = {
unnamed: { req: false, valid: /^hidden$/i },
'float': { req: false, valid: /^(left|right)$/i },
align: { req: false, valid: /^(left|right|center)$/i },
margin: { req: false, valid: /^\d+$/ },
margin: { req: false, valid: /^\d+(px|em|\%)$/ },
width: { req: false, valid: /^[0-9]+(px|em|\%)$/ }
},
allowedClass: MARKUP_CLASS_STAFF,
@@ -1739,7 +1739,7 @@ var Markup = {
if(g_quests[id] && g_quests[id][nameCol])
{
var quest = g_quests[id];
return '<a href="' + url + '?quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/tiny/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
return '<a href="' + url + '?quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/icons/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
}
return '<a href="' + url + '?quest=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[5][0] + ' #' + id + ')</a>';
},

View File

@@ -825,132 +825,164 @@ function g_formatTimeSimple(d, txt, noPrefix) {
return txt;
}
function g_cleanCharacterName(e) {
var d = "";
for (var c = 0, a = e.length; c < a; ++c) {
var b = e.charAt(c).toLowerCase();
if (b >= "a" && b <= "z") {
d += b
} else {
d += e.charAt(c)
}
}
return d
}
function g_createGlow(a, h) {
var e = $WH.ce("span");
for (var c = -1; c <= 1; ++c) {
for (var b = -1; b <= 1; ++b) {
var g = $WH.ce("div");
g.style.position = "absolute";
g.style.whiteSpace = "nowrap";
g.style.left = c + "px";
g.style.top = b + "px";
if (c == 0 && b == 0) {
g.style.zIndex = 4
} else {
g.style.color = "black";
g.style.zIndex = 2
function g_createGlow(txt, cn) {
var s = $WH.ce('span');
for (var i = -1; i <= 1; ++i) {
for (var j = -1; j <= 1; ++j) {
var d = $WH.ce('div');
d.style.position = 'absolute';
d.style.whiteSpace = 'nowrap';
d.style.left = i + 'px';
d.style.top = j + 'px';
if (i == 0 && j == 0) {
d.style.zIndex = 4;
}
g.innerHTML = a;
$WH.ae(e, g)
else {
d.style.color = 'black';
d.style.zIndex = 2;
}
//$WH.ae(d, $WH.ct(txt));
d.innerHTML = txt;
$WH.ae(s, d);
}
}
e.style.position = "relative";
e.className = "glow" + (h != null ? " " + h: "");
var f = $WH.ce("span");
f.style.visibility = "hidden";
$WH.ae(f, $WH.ct(a));
$WH.ae(e, f);
return e
s.style.position = 'relative';
s.className = 'glow' + (cn != null ? ' ' + cn : '');
var ph = $WH.ce('span');
ph.style.visibility = 'hidden';
$WH.ae(ph, $WH.ct(txt));
$WH.ae(s, ph);
return s;
}
function g_createProgressBar(c) {
if (c == null) {
c = {}
function g_createProgressBar(opt) {
if (opt == null) {
opt = {};
}
if (!c.text) {
c.text = " "
if (typeof opt.text == 'undefined') {
opt.text = ' ';
}
if (c.color == null) {
c.color = "rep0"
if (opt.color == null) {
opt.color = 'rep0';
}
if (c.width == null || c.width > 100) {
c.width = 100
if (opt.width == null || opt.width > 100) {
opt.width = 100;
}
var d, e;
if (c.hoverText) {
d = $WH.ce("a");
d.href = "javascript:;"
} else {
d = $WH.ce("span")
var el, div;
if (opt.hoverText) {
el = $WH.ce('a');
el.href = 'javascript:;';
}
d.className = "progressbar";
if (c.text || c.hoverText) {
e = $WH.ce("div");
e.className = "progressbar-text";
if (c.text) {
var a = $WH.ce("del");
$WH.ae(a, $WH.ct(c.text));
$WH.ae(e, a)
else {
el = $WH.ce('span');
}
el.className = 'progressbar';
if (opt.text || opt.hoverText) {
div = $WH.ce('div');
div.className = 'progressbar-text';
if (opt.text) {
var del = $WH.ce('del');
$WH.ae(del, $WH.ct(opt.text));
$WH.ae(div, del);
}
if (c.hoverText) {
var b = $WH.ce("ins");
$WH.ae(b, $WH.ct(c.hoverText));
$WH.ae(e, b)
if (opt.hoverText) {
var ins = $WH.ce('ins');
$WH.ae(ins, $WH.ct(opt.hoverText));
$WH.ae(div, ins);
}
$WH.ae(d, e)
$WH.ae(el, div);
}
e = $WH.ce("div");
e.className = "progressbar-" + c.color;
e.style.width = c.width + "%";
$WH.ae(e, $WH.ct(String.fromCharCode(160)));
$WH.ae(d, e);
return d
div = $WH.ce('div');
div.className = 'progressbar-' + opt.color;
div.style.width = opt.width + '%';
if (opt.height) {
div.style.height = opt.height;
}
$WH.ae(div, $WH.ct(String.fromCharCode(160)));
$WH.ae(el, div);
if (opt.text) {
var div = $WH.ce('div');
div.className = 'progressbar-text progressbar-hidden';
$WH.ae(div, $WH.ct(opt.text));
$WH.ae(el, div);
}
return el;
}
function g_createReputationBar(g) {
var f = g_createReputationBar.P;
if (!g) {
g = 0
function g_createReputationBar(totalRep) {
var P = g_createReputationBar.P;
if (!totalRep) {
totalRep = 0;
}
g += 42000;
if (g < 0) {
g = 0
} else {
if (g > 84999) {
g = 84999
totalRep += 42000;
if (totalRep < 0) {
totalRep = 0;
}
else if (totalRep > 84999) {
totalRep = 84999;
}
var
currentRep = totalRep,
maxRep,
standing = 0;
for (var i = 0, len = P.length; i < len; ++i) {
if (P[i] > currentRep) {
break;
}
if (i < len - 1) {
currentRep -= P[i];
standing = i + 1;
}
}
var e = g,
h, b = 0;
for (var d = 0, a = f.length; d < a; ++d) {
if (f[d] > e) {
break
}
if (d < a - 1) {
e -= f[d];
b = d + 1
}
}
h = f[b];
var c = {
text: g_reputation_standings[b],
hoverText: e + " / " + h,
color: "rep" + b,
width: parseInt(e / h * 100)
maxRep = P[standing];
var opt = {
text: g_reputation_standings[standing],
hoverText: currentRep + ' / ' + maxRep,
color: 'rep' + standing,
width: parseInt(currentRep / maxRep * 100)
};
return g_createProgressBar(c)
return g_createProgressBar(opt);
}
g_createReputationBar.P = [36000, 3000, 3000, 3000, 6000, 12000, 21000, 999];
function g_createAchievementBar(b, d, a) {
if (!b) {
b = 0
function g_createAchievementBar(points, outOf, overall, bonus) {
if (!points) {
points = 0;
}
var c = {
text: b + (d > 0 ? " / " + d: ""),
color: (a ? "rep7": "ach" + (d > 0 ? 0 : 1)),
width: (d > 0 ? parseInt(b / d * 100) : 100)
var opt = {
text: points + (bonus > 0 ? '(+' + bonus + ')': '') + (outOf > 0 ? ' / ' + outOf: ''),
color: (overall ? 'rep7' : 'ach' + (outOf > 0 ? 0 : 1)),
width: (outOf > 0 ? parseInt(points / outOf * 100) : 100)
};
return g_createProgressBar(c)
return g_createProgressBar(opt);
}
function g_getMoneyHtml(money, side, costItems, costCurrency, achievementPoints) {

View File

@@ -27,7 +27,7 @@
{include file='bricks/redButtons.tpl'}
<h1 class="h1-icon">{$lvData.page.name}</h1>
<h1>{$lvData.page.name}</h1>
{include file='bricks/article.tpl'}