Tooltips/Cleanup

* removed double escaped json
 * fixed itemset tooltips with classes
 * set cookies to samesite to avoid being rejected by the browser
This commit is contained in:
Sarjuuk
2020-10-10 10:51:56 +02:00
parent 59fb6c1bc9
commit 0430d75989
7 changed files with 22 additions and 18 deletions

View File

@@ -226,7 +226,7 @@ class AchievementList extends BaseType
break; break;
} }
$criteria .= '<!--cr'.$crt['id'].':'.$crt['type'].':'.$crt['value1'].'-->- '.Util::jsEscape($crtName); $criteria .= '<!--cr'.$crt['id'].':'.$crt['type'].':'.$crt['value1'].'-->- '.$crtName;
if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER) if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER)
$criteria .= '&nbsp;<span class="moneygold">'.Lang::nf($crt['value2' ] / 10000).'</span>'; $criteria .= '&nbsp;<span class="moneygold">'.Lang::nf($crt['value2' ] / 10000).'</span>';
@@ -238,13 +238,13 @@ class AchievementList extends BaseType
} }
$x = '<table><tr><td><b class="q">'; $x = '<table><tr><td><b class="q">';
$x .= Util::jsEscape($name); $x .= $name;
$x .= '</b></td></tr></table>'; $x .= '</b></td></tr></table>';
if ($description || $criteria) if ($description || $criteria)
$x .= '<table><tr><td>'; $x .= '<table><tr><td>';
if ($description) if ($description)
$x .= '<br />'.Util::jsEscape($description).'<br />'; $x .= '<br />'.$description.'<br />';
if ($criteria) if ($criteria)
{ {

View File

@@ -69,11 +69,11 @@ class CurrencyList extends BaseType
return array(); return array();
$x = '<table><tr><td>'; $x = '<table><tr><td>';
$x .= '<b>'.Util::jsEscape($this->getField('name', true)).'</b><br>'; $x .= '<b>'.$this->getField('name', true).'</b><br>';
// cata+ (or go fill it by hand) // cata+ (or go fill it by hand)
if ($_ = $this->getField('description', true)) if ($_ = $this->getField('description', true))
$x .= '<div style="max-width: 300px" class="q">'.Util::jsEscape($_).'</div>'; $x .= '<div style="max-width: 300px" class="q">'.$_.'</div>';
if ($_ = $this->getField('cap')) if ($_ = $this->getField('cap'))
$x .= '<br><span class="q">'.Lang::currency('cap').Lang::main('colon').'</span>'.Lang::nf($_).'<br>'; $x .= '<br><span class="q">'.Lang::currency('cap').Lang::main('colon').'</span>'.Lang::nf($_).'<br>';

View File

@@ -98,19 +98,21 @@ class ItemsetList extends BaseType
return array(); return array();
$x = '<table><tr><td>'; $x = '<table><tr><td>';
$x .= '<span class="q'.$this->getField('quality').'">'.Util::jsEscape($this->getField('name', true)).'</span><br />'; $x .= '<span class="q'.$this->getField('quality').'">'.$this->getField('name', true).'</span><br />';
$nClasses = 0; $nCl = 0;
if ($_ = $this->getField('classMask')) if ($_ = $this->getField('classMask'))
{ {
$cl = Lang::getClassString($_, $__, $nClasses); $jsg = [];
$x .= Util::ucFirst($nClasses > 1 ? Lang::game('classes') : Lang::game('class')).Lang::main('colon').$cl.'<br />'; $cl = Lang::getClassString($_, $jsg);
$nCl = count($jsg);
$x .= Util::ucFirst($nCl > 1 ? Lang::game('classes') : Lang::game('class')).Lang::main('colon').$cl.'<br />';
} }
if ($_ = $this->getField('contentGroup')) if ($_ = $this->getField('contentGroup'))
$x .= Util::jsEscape(Lang::itemset('notes', $_)).($this->getField('heroic') ? ' <i class="q2">('.Lang::item('heroic').')</i>' : '').'<br />'; $x .= Lang::itemset('notes', $_).($this->getField('heroic') ? ' <i class="q2">('.Lang::item('heroic').')</i>' : '').'<br />';
if (!$nClasses || !$this->getField('contentGroup')) if (!$nCl || !$this->getField('contentGroup'))
$x.= Lang::itemset('types', $this->getField('type')).'<br />'; $x.= Lang::itemset('types', $this->getField('type')).'<br />';
if ($bonuses = $this->getBonuses()) if ($bonuses = $this->getBonuses())
@@ -118,7 +120,7 @@ class ItemsetList extends BaseType
$x .= '<span>'; $x .= '<span>';
foreach ($bonuses as $b) foreach ($bonuses as $b)
$x .= '<br /><span class=\"q13\">'.$b['bonus'].' '.Lang::itemset('_pieces').Lang::main('colon').'</span>'.Util::jsEscape($b['desc']); $x .= '<br /><span class="q13">'.$b['bonus'].' '.Lang::itemset('_pieces').Lang::main('colon').'</span>'.$b['desc'];
$x .= '</span>'; $x .= '</span>';
} }

View File

@@ -54,11 +54,11 @@ class SkillList extends BaseType
'category' => $this->curTpl['typeCat'], 'category' => $this->curTpl['typeCat'],
'categorybak' => $this->curTpl['categoryId'], 'categorybak' => $this->curTpl['categoryId'],
'id' => $this->id, 'id' => $this->id,
'name' => Util::jsEscape($this->getField('name', true)), 'name' => $this->getField('name', true),
'profession' => $this->curTpl['professionMask'], 'profession' => $this->curTpl['professionMask'],
'recipeSubclass' => $this->curTpl['recipeSubClass'], 'recipeSubclass' => $this->curTpl['recipeSubClass'],
'specializations' => Util::toJSON($this->curTpl['specializations'], JSON_NUMERIC_CHECK), 'specializations' => Util::toJSON($this->curTpl['specializations'], JSON_NUMERIC_CHECK),
'icon' => Util::jsEscape($this->curTpl['iconString']) 'icon' => $this->curTpl['iconString']
); );
} }
@@ -70,7 +70,7 @@ class SkillList extends BaseType
$data = []; $data = [];
foreach ($this->iterate() as $__) foreach ($this->iterate() as $__)
$data[self::$type][$this->id] = ['name' => Util::jsEscape($this->getField('name', true)), 'icon' => Util::jsEscape($this->curTpl['iconString'])]; $data[self::$type][$this->id] = ['name' => $this->getField('name', true), 'icon' => $this->curTpl['iconString']];
return $data; return $data;
} }

View File

@@ -90,7 +90,7 @@ class SoundList extends BaseType
foreach ($this->iterate() as $__) foreach ($this->iterate() as $__)
$data[self::$type][$this->id] = array( $data[self::$type][$this->id] = array(
'name' => Util::jsEscape($this->getField('name', true)), 'name' => $this->getField('name', true),
'type' => $this->getField('cat'), 'type' => $this->getField('cat'),
'files' => array_values(array_filter($this->getField('files'))) 'files' => array_values(array_filter($this->getField('files')))
); );

View File

@@ -175,7 +175,7 @@ class WorldEventList extends BaseType
$x = '<table><tr><td>'; $x = '<table><tr><td>';
// head v that extra % is nesecary because we are using sprintf later on // head v that extra % is nesecary because we are using sprintf later on
$x .= '<table width="100%%"><tr><td><b>'.Util::jsEscape($this->getField('name', true)).'</b></td><th><b class="q0">'.Lang::event('category', $this->getField('category')).'</b></th></tr></table>'; $x .= '<table width="100%%"><tr><td><b>'.$this->getField('name', true).'</b></td><th><b class="q0">'.Lang::event('category', $this->getField('category')).'</b></th></tr></table>';
// use string-placeholder for dates // use string-placeholder for dates
// start // start
@@ -188,7 +188,7 @@ class WorldEventList extends BaseType
// desc // desc
if ($this->getField('holidayId')) if ($this->getField('holidayId'))
if ($_ = $this->getField('description', true)) if ($_ = $this->getField('description', true))
$x .= '<table><tr><td><span class="q">'.Util::jsEscape($_).'</span></td></tr></table>'; $x .= '<table><tr><td><span class="q">'.$_.'</span></td></tr></table>';
return $x; return $x;
} }

View File

@@ -507,6 +507,8 @@ $WH.sc = function(z, y, x, w, v) {
a.setDate(a.getDate() + y); a.setDate(a.getDate() + y);
b += "expires=" + a.toUTCString() + "; "; b += "expires=" + a.toUTCString() + "; ";
b += "SameSite=strict;";
if (w) { if (w) {
b += "path=" + w + "; "; b += "path=" + w + "; ";
} }