diff --git a/config/config.php.in b/config/config.php.in index c6c5db49..a17368e3 100644 --- a/config/config.php.in +++ b/config/config.php.in @@ -47,8 +47,10 @@ $AoWoWconf['characters'][0] = array( // $AoWoWconf['characters'][1] = array(); // -- Site Configuration -- -$AoWoWconf['page']['name'] = 'Aowow Database Viewer (ADV)'; // Title of the website $AoWoWconf['page']['cacheTimer'] = 60*60*24*7; // Time to keep cache in seconds (Default: 1 week) +$AoWoWconf['page']['name'] = 'Aowow Database Viewer (ADV)'; // Title of the website +$AoWoWconf['page']['shortName'] = 'Aowow'; // used in Feeds +$AoWoWconf['ttl'] = 60; // time to live for RSS $AoWowConf['cookieTimeout'] = 5*60*1000; // cookie times out in time() + X $AoWoWconf['register'] = true; // Allow account creating // $AoWoWconf['loginFailCount'] = 5; // how often invalid passwords are tollerated diff --git a/includes/class.achievement.php b/includes/class.achievement.php index dac90240..c10a1a4b 100644 --- a/includes/class.achievement.php +++ b/includes/class.achievement.php @@ -14,7 +14,7 @@ class AchievementList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_achievement WHERE [filter] [cond] GROUP BY Id ORDER BY `orderInGroup` ASC'; - public function __construct($conditions, $applyFilter = false) + public function __construct($conditions = [], $applyFilter = false) { parent::__construct($conditions, $applyFilter); diff --git a/includes/class.charclass.php b/includes/class.charclass.php index a9cc8f2f..921a3c77 100644 --- a/includes/class.charclass.php +++ b/includes/class.charclass.php @@ -9,6 +9,15 @@ class CharClassList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC'; + public function __construct($conditions = []) + { + parent::__construct($conditions); + + foreach ($this->iterate() as $k => &$_curTpl) + if ($k == 6) // todo (low): grr, move to db + $_curTpl['hero'] = 1; + } + public function getListviewData() { $data = []; @@ -25,9 +34,6 @@ class CharClassList extends BaseType 'power' => $this->curTpl['powerType'], ); - if ($this->curTpl['expansion'] == 2) // todo (low): grr, move to db - $data[$this->id]['hero'] = 1; - if ($this->curTpl['expansion']) $data[$this->id]['expansion'] = $this->curTpl['expansion']; } diff --git a/includes/class.item.php b/includes/class.item.php index 7a719418..798fc938 100644 --- a/includes/class.item.php +++ b/includes/class.item.php @@ -21,7 +21,7 @@ class ItemList extends BaseType protected $setupQuery = 'SELECT *, i.entry AS ARRAY_KEY FROM item_template i LEFT JOIN ?_item_template_addon iX ON i.entry = iX.id LEFT JOIN locales_item l ON i.entry = l.entry WHERE [filter] [cond] ORDER BY i.Quality DESC'; - public function __construct($conditions, $miscData = null) + public function __construct($conditions = [], $miscData = null) { // search by statweight if ($miscData && isset($miscData['wt']) && isset($miscData['wtv']) && count($miscData['wt']) == count($miscData['wtv'])) @@ -281,7 +281,7 @@ class ItemList extends BaseType // conjured if ($this->curTpl['Flags'] & ITEM_FLAG_CONJURED) - $x .= '
'.Lang::$game['conjured']; + $x .= '
'.Lang::$item['conjured']; // bonding if (($this->curTpl['Flags'] & ITEM_FLAG_ACCOUNTBOUND) && $this->curTpl['Quality'] == ITEM_QUALITY_HEIRLOOM) diff --git a/includes/class.itemset.php b/includes/class.itemset.php index c2c160c0..b772627a 100644 --- a/includes/class.itemset.php +++ b/includes/class.itemset.php @@ -14,9 +14,9 @@ class ItemsetList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel DESC'; - public function __construct($data, $applyFilter = false) + public function __construct($conditions = [], $applyFilter = false) { - parent::__construct($data, $applyFilter); + parent::__construct($conditions, $applyFilter); // post processing foreach ($this->iterate() as &$_curTpl) diff --git a/includes/class.quest.php b/includes/class.quest.php index 99e14c6d..9e67657a 100644 --- a/includes/class.quest.php +++ b/includes/class.quest.php @@ -9,7 +9,7 @@ class QuestList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM quest_template qt LEFT JOIN locales_quest lq ON qt.Id = lq.entry WHERE [filter] [cond] ORDER BY Id ASC'; - public function __construct($conditions) + public function __construct($conditions = []) { parent::__construct($conditions); diff --git a/includes/class.skill.php b/includes/class.skill.php index 16bdd54a..1b302cc2 100644 --- a/includes/class.skill.php +++ b/includes/class.skill.php @@ -10,9 +10,9 @@ class SkillList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_skillLine sl WHERE [cond] ORDER BY id ASC'; - public function __construct($data) + public function __construct($conditions = []) { - parent::__construct($data); + parent::__construct($conditions); // post processing foreach ($this->iterate() as &$_curTpl) diff --git a/includes/class.spell.php b/includes/class.spell.php index 1836e952..b6fa3541 100644 --- a/includes/class.spell.php +++ b/includes/class.spell.php @@ -36,7 +36,7 @@ class SpellList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_spell s WHERE [filter] [cond]'; - public function __construct($conditions, $applyFilter = false) + public function __construct($conditions = [], $applyFilter = false) { parent::__construct($conditions, $applyFilter); @@ -1023,6 +1023,9 @@ class SpellList extends BaseType $eq(a, b) - a == b $floor(a) - floor() $gt(a, b) - a > b + $gte(a, b) - a >= b + $min(a, b) - min() + $max(a, b) - max() */ $this->interactive = $interactive; diff --git a/includes/class.title.php b/includes/class.title.php index 4a141b3b..cdcf0bba 100644 --- a/includes/class.title.php +++ b/includes/class.title.php @@ -13,9 +13,9 @@ class TitleList extends BaseType protected $setupQuery = 'SELECT *, id AS ARRAY_KEY FROM ?_titles WHERE [cond] ORDER BY Id ASC'; - public function __construct($data) + public function __construct($conditions = []) { - parent::__construct($data); + parent::__construct($conditions); // post processing foreach ($this->iterate() as $__) diff --git a/includes/class.worldevent.php b/includes/class.worldevent.php index 6974427c..d2aa9b48 100644 --- a/includes/class.worldevent.php +++ b/includes/class.worldevent.php @@ -9,9 +9,9 @@ class WorldEventList extends BaseType protected $setupQuery = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e LEFT JOIN ?_holidays h ON e.holidayId = h.id WHERE [cond] ORDER BY -e.id ASC'; - public function __construct($data) + public function __construct($conditions = []) { - parent::__construct($data); + parent::__construct($conditions); // unseting elements while we iterate over the array will cause the pointer to reset $replace = []; diff --git a/includes/utilities.php b/includes/utilities.php index 7fe5a542..03ab4cfe 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -55,7 +55,7 @@ abstract class BaseType $limit = ' LIMIT '.$AoWoWconf['sqlLimit']; $className = get_class($this); - if (!$this->setupQuery) + if (!$this->setupQuery || $conditions === null) return; // may be called without filtering @@ -213,6 +213,15 @@ abstract class BaseType return is_numeric($value) ? floatVal($value) : $value; } + public function getRandomId() + { + $pattern = '/SELECT .* (-?[\w_]*\.?(id|entry)) AS ARRAY_KEY,?.* FROM (.*) WHERE .*/i'; + $replace = 'SELECT $1 FROM $3 ORDER BY RAND() ASC LIMIT 1'; + $query = preg_replace($pattern, $replace, $this->setupQuery); + + return DB::Aowow()->selectCell($query); + } + public function getFoundIDs() { return array_keys($this->templates); @@ -441,10 +450,10 @@ class Lang $tmp = []; if ($flags & CUSTOM_DISABLED) - $tmp[] = ''.self::$main['disabled'].''; + $tmp[] = ''.self::$main['disabled'].''; if ($flags & CUSTOM_SERVERSIDE) - $tmp[] = ''.self::$main['serverside'].''; + $tmp[] = ''.self::$main['serverside'].''; return $tmp; } @@ -679,28 +688,40 @@ class SmartyAoWoW extends Smarty public function display($tpl) { $tv = &$this->_tpl_vars; - $_ = []; + // fetch article & static infobox if ($tv['page']['type'] && $tv['page']['typeId']) { - if ($article = DB::Aowow()->selectRow('SELECT id, article, quickInfo FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = ?d', $tv['page']['type'], $tv['page']['typeId'], User::$localeId)) + $article = DB::Aowow()->selectRow( + 'SELECT SQL_CALC_FOUND_ROWS article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = ?d UNION ALL '. + 'SELECT article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = 0 AND FOUND_ROWS() = 0', + $tv['page']['type'], $tv['page']['typeId'], User::$localeId, + $tv['page']['type'], $tv['page']['typeId'] + ); + + if ($article) { - $globals = DB::Aowow()->select('SELECT type, typeId FROM ?_article_items WHERE id = ?d', $article['id']); + $tv['article'] = ['text' => $article['article']]; + if (empty($tv['infobox']) && !empty($article['quickInfo'])) + $tv['infobox'] = $article['quickInfo']; - $tv['article'] = $article['article']; - @$tv['infoBox'] .= $article['quickInfo']; + if ($article['locale'] != User::$localeId) + $tv['article']['params'] = ['prepend' => Util::jsEscape('
'.Lang::$main['englishOnly'].'
')]; - foreach ($globals as $glob) - { - if (!isset($this->jsGlobals[$glob['type']])) - $this->jsGlobals[$glob['type']] = []; + foreach ($article as $text) + if (preg_match_all('/\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|title|holiday|class|race|skill|currency)=(\d+)[^\]]*\]/i', $text, $matches, PREG_SET_ORDER)) + foreach ($matches as $match) + if ($type = array_search($match[1], Util::$typeStrings)) + { + if (!isset($this->jsGlobals[$type])) + $this->jsGlobals[$type] = []; - $this->jsGlobals[$glob['type']][] = $glob['typeId']; - } + $this->jsGlobals[$type][] = $match[2]; + } } } - // since it's the same for every page, except index.. + // fetch announcements if ($tv['query'][0] && !preg_match('/[^a-z]/i', $tv['query'][0])) { $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ?s OR page = "*")', $tv['query'][0]); diff --git a/index.php b/index.php index e31fa75e..7449fa68 100644 --- a/index.php +++ b/index.php @@ -98,13 +98,14 @@ switch ($pageCall) case '': // no parameter given -> MainPage require 'pages/main.php'; break; + case 'latest-additions': + case 'latest-articles': case 'latest-comments': case 'latest-screenshots': case 'latest-videos': - case 'missing-comments': - case 'missing-screenshots': - case 'missing-videos': case 'unrated-comments': + case 'missing-screenshots': + case 'most-comments': case 'random': require 'pages/miscTools.php'; break; diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 6755192b..b477a395 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -81,7 +81,18 @@ $lang = array( // red buttons 'links' => "Links", 'compare' => "Vergleichen", - 'view3D' => "3D-Ansicht" + 'view3D' => "3D-Ansicht", + + // miscTooles + 'subscribe' => "Abonnieren", + 'mostComments' => ["Gestern", "Vergangene %d Tage"], + 'utilities' => array( + "Neueste Ergänzungen", "Neueste Artikel", "Neueste Kommentare", "Neueste Screenshots", null, + "Nicht bewertete Kommentare", 11 => "Neueste Videos", 12 => "Meiste Kommentare", 13 => "Fehlende Screenshots" + ), + + // article & infobox + 'englishOnly' => "Diese Seite ist nur in Englisch verfügbar." ), 'search' => array( 'search' => "Suche", @@ -134,6 +145,15 @@ $lang = array( 'valueDelim' => " - ", // " bis " 'zone' => "Zone", 'zones' => "Gebiete", + + 'heroClass' => "Heldenklasse", + 'resource' => "Ressource", + 'resources' => "Ressourcen", + 'role' => "Rolle", + 'roles' => "Rollen", + 'specs' => "Spezialisierungen", + '_roles' => ['Heiler', 'Nahkampf-DPS', 'Distanz-DPS', 'Tank'], + 'expansions' => array("Classic", "The Burning Crusade", "Wrath of the Lich King"), 'stats' => array("Stärke", "Beweglichkeit", "Ausdauer", "Intelligenz", "Willenskraft"), 'languages' => array( @@ -149,7 +169,7 @@ $lang = array( 'ra' => array(-2 => "Horde", -1 => "Allianz", "Beide", "Mensch", "Orc", "Zwerg", "Nachtelf", "Untoter", "Taure", "Gnom", "Troll", null, "Blutelf", "Draenei"), 'rep' => array("Hasserfüllt", "Feindselig", "Unfreundlich", "Neutral", "Freundlich", "Wohlwollend", "Respektvoll", "Ehrfürchtig"), 'st' => array( - null, "Katzengestalt", "Baum des Lebens", "Reisegestalt", "Wassergestalt", + "Vorgabe", "Katzengestalt", "Baum des Lebens", "Reisegestalt", "Wassergestalt", "Bärengestalt", null, null, "Terrorbärengestalt", null, null, null, null, "Schattentanz", null, null, "Geisterwolf", "Kampfhaltung", "Verteidigungshaltung", "Berserkerhaltung", @@ -313,14 +333,14 @@ $lang = array( '_tag' => "Tag", 'notes' => array( - null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set", + null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set", "Tier 2 Raid-Set", "Tier 3 Raid-Set", "Level 60 PvP-Set (Rar)", "Level 60 PvP-Set (Rar, alt)", "Level 60 PvP-Set (Episch)", "Set der Ruinen von Ahn'Qiraj", "Set des Tempels von Ahn'Qiraj", "Set von Zul'Gurub", "Tier 4 Raid-Set", "Tier 5 Raid-Set", "Dungeon-Set 3", "Set des Arathibeckens", "Level 70 PvP-Set (Rar)", "Arena-Set Saison 1", "Tier 6 Raid-Set", "Arena-Set Saison 2", "Arena-Set Saison 3", "Level 70 PvP-Set 2 (Rar)", "Arena-Set Saison 4", "Tier 7 Raid-Set", "Arena-Set Saison 5", "Tier 8 Raid-Set", "Arena-Set Saison 6", "Tier 9 Raid-Set", - "Arena-Set Saison 7", "Tier 10 Raid-Set", "Arena-Set Saison 8" + "Arena-Set Saison 7", "Tier 10 Raid-Set", "Arena-Set Saison 8" ), 'types' => array( null, "Stoff", "Leder", "Schwere Rüstung", "Platte", "Dolch", "Ring", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 4edfbf5e..009638de 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -76,7 +76,18 @@ $lang = array( // red buttons 'links' => "Links", 'compare' => "Compare", - 'view3D' => "View in 3D" + 'view3D' => "View in 3D", + + // misc Tools + 'subscribe' => "Subscribe", + 'mostComments' => ["Yesterday", "Past %d Days"], + 'utilities' => array( + "Latest Additions", "Latest Articles", "Latest Comments", "Latest Screenshots", null, + "Unrated Comments", 11 => "Latest Videos", 12 => "Most Comments", 13 => "Missing Screenshots" + ), + + // article & infobox + 'englishOnly' => "This page is only available in English." ), 'search' => array( 'search' => "Search", @@ -129,6 +140,15 @@ $lang = array( 'valueDelim' => " to ", 'zone' => "zone", 'zones' => "Zones", + + 'heroClass' => "Hero class", + 'resource' => "Resource", + 'resources' => "Resources", + 'role' => "Role", + 'roles' => "Roles", + 'specs' => "Specs", + '_roles' => ['Healer', 'Melee DPS', 'Ranged DPS', 'Tank'], + 'expansions' => array("Classic", "The Burning Crusade", "Wrath of the Lich King"), 'stats' => array("Strength", "Agility", "Stamina", "Intellect", "Spirit"), 'languages' => array( @@ -144,7 +164,7 @@ $lang = array( 'ra' => array(-2 => "Horde", -1 => "Alliance", "Both", "Human", "Orc", "Dwarf", "Night Elf", "Undead", "Tauren", "Gnome", "Troll", null, "Blood Elf", "Draenei"), 'rep' => array("Hated", "Hostile", "Unfriendly", "Neutral", "Friendly", "Honored", "Revered", "Exalted"), 'st' => array( - null, "Cat Form", "Tree of Life", "Travel Form", "Aquatic Form", + "Default", "Cat Form", "Tree of Life", "Travel Form", "Aquatic Form", "Bear From", null, null, "Dire Bear Form", null, null, null, null, "Shadowdance", null, null, "Ghostwolf", "Battle Stance", "Defensive Stance", "Berserker Stance", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 0d16f923..57861c5e 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -37,7 +37,7 @@ $lang = array( 'rewards' => "Recompensas", 'gains' => "Ganancias", 'login' => "[Login]", - 'forum' => "[Forum]", + 'forum' => "Foro", 'days' => "dias", 'hours' => "horas", 'minutes' => "minutos", @@ -73,7 +73,18 @@ $lang = array( // red buttons 'links' => "Enlaces", 'compare' => "Comparar", - 'view3D' => "Ver en 3D" + 'view3D' => "Ver en 3D", + + // misc Tools + 'subscribe' => "Suscribirme", + 'mostComments' => ["Ayer", "Pasados %d días"], + 'utilities' => array( + "Últimas adiciones", "Últimos artículos", "Últimos comentarios", "Últimas capturas de pantalla", null, + "Comentarios sin valorar", 11 => "Últimos vídeos", 12 => "Mayoría de comentarios", 13 => "Capturas de pantalla faltantes" + ), + + // article & infobox + 'englishOnly' => "Esta página sólo está disponible en inglés." ), 'search' => array( 'search' => "Búsqueda", @@ -126,6 +137,15 @@ $lang = array( 'valueDelim' => " - ", 'zone' => "zona", 'zones' => "Zonas", + + 'heroClass' => "Clase héroe", + 'resource' => "Recurso", + 'resources' => "Recursos", + 'role' => "Rol", + 'roles' => "Roles", + 'specs' => "Especializaciones", + '_roles' => ['Sanador', 'DPS cuerpo', 'DPS a distancia', 'Tanque'], + 'expansions' => array("World of Warcraft", "The Burning Crusade", "Wrath of the Lich King"), 'stats' => array("Fuerza", "Agilidad", "Aguante", "Intelecto", "Espíritu"), 'languages' => array( @@ -141,7 +161,7 @@ $lang = array( 'ra' => array(-2 => "Horda", -1 => "Alianza", "Ambos", "Humano", "Orco", "Enano", "Elfo de la noche", "No-muerto", "Tauren", "Gnomo", "Trol ", null, "Blood Elf", "Elfo de sangre"), 'rep' => array("Odiado", "Hostil", "Adverso", "Neutral", "Amistoso", "Honorable", "Reverenciado", "Exaltado"), 'st' => array( - null, "Forma felina", "Árbol de vida", "Forma de viaje", "Forma acuática", + "Defecto", "Forma felina", "Árbol de vida", "Forma de viaje", "Forma acuática", "Forma de oso", null, null, "Forma de oso temible", null, null, null, null, "Danza de las Sombras", null, null, "Lobo fantasmal", "Actitud de batalla", "Actitud defensiva", "Actitud rabiosa", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index b990a0d3..82aeab69 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -37,7 +37,7 @@ $lang = array( 'rewards' => "Récompenses", 'gains' => "Gains", 'login' => "[Login]", - 'forum' => "[Forum]", + 'forum' => "Forum", 'days' => "jours", 'hours' => "heures", 'minutes' => "minutes", @@ -73,7 +73,18 @@ $lang = array( // red buttons 'links' => "Liens", 'compare' => "Comparer", - 'view3D' => "Voir en 3D" + 'view3D' => "Voir en 3D", + + // misc Tools + 'subscribe' => "S'abonner", + 'mostComments' => ["Hier", "Derniers %d jours"], + 'utilities' => array( + "Derniers ajouts", "Derniers articles", "Derniers commentaires", "Dernières captures d'écran", null, + "Commentaire sans note", 11 => "Derniers vidéos", 12 => "Le plus de commentaires", 13 => "Captures d'écrans manquantes" + ), + + // article & infobox + 'englishOnly' => "Cette page n'est disponible qu'en anglais pour le moment." ), 'search' => array( 'search' => "Recherche", @@ -126,6 +137,15 @@ $lang = array( 'valueDelim' => " - ", 'zone' => "zone", 'zones' => "Zones", + + 'heroClass' => "Classe de héros", + 'resource' => "Ressource", + 'resources' => "Ressources", + 'role' => "Role", + 'roles' => "Roles", + 'specs' => "Specialisations", + '_roles' => ['Soigneur', 'DPS mêlée', 'DPS à distance', 'Tank'], + 'expansions' => array("Classique", "The Burning Crusade", "Wrath of the Lich King"), 'stats' => array("Force", "Agilité", "Endurance", "Intelligence", "Esprit"), 'languages' => array( @@ -141,7 +161,7 @@ $lang = array( 'ra' => array(-2 => "Horde", -1 => "Alliance", "Les deux", "Humain", "Orc", "Nain", "Elfe de la nuit", "Mort-vivant", "Tauren", "Gnome", "Troll", null, "Elfe de sang", "Draeneï"), 'rep' => array("Détesté", "Hostile", "Inamical", "Neutre", "Amical", "Honoré", "Révéré", "Exalté"), 'st' => array( - null, "Forme de félin", "Arbre de vie", "Forme de voyage", "Aquatic Form", + "Défaut", "Forme de félin", "Arbre de vie", "Forme de voyage", "Aquatic Form", "Forme d'ours", null, null, "Forme d'ours redoutable", null, null, null, null, "Danse de l'ombre", null, null, "Ghostwolf", "Posture de combat", "Posture défensive", "Posture berserker", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index e091172e..6ed3256c 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -37,7 +37,7 @@ $lang = array( 'rewards' => "Награды", 'gains' => "Бонус", 'login' => "[Login]", - 'forum' => "[Forum]", + 'forum' => "Форум", 'days' => "дн", 'hours' => "часы", 'minutes' => "мин", @@ -73,7 +73,18 @@ $lang = array( // red buttons 'links' => "Ссылки", 'compare' => "Сравнить", - 'view3D' => "Посмотреть в 3D" + 'view3D' => "Посмотреть в 3D", + + // misc Tools + 'subscribe' => "Подписаться", + 'mostComments' => ["Вчера", "Последние %d дней"], + 'utilities' => array( + "Последние добавления", "Последние статьи", "Последние комментарии", "Последние изображения", null, + "Комментарии без оценки", 11 => "Последние видео", 12 => "Популярные комментируемые", 13 => "Без изображений" + ), + + // article & infobox + 'englishOnly' => "Эта страница доступна только на английском языке." ), 'search' => array( 'search' => "Поиск", @@ -126,6 +137,15 @@ $lang = array( 'valueDelim' => " - ", 'zone' => "игровая зона", 'zones' => "Местности", + + 'heroClass' => "Героический класс", + 'resource' => "Ресурс", + 'resources' => "Ресурсы", + 'role' => "Роль", + 'roles' => "Роли", + 'specs' => "Ветки талантов", + '_roles' => ['Лекарь', 'Боец ближнего боя', 'Боец дальнего боя', 'Танк'], + 'expansions' => array("World of Warcraft", "The Burning Crusade", "Wrath of the Lich King"), 'stats' => array("к силе", "к ловкости", "к выносливости", "к интеллекту", "к духу"), 'languages' => array( @@ -141,7 +161,7 @@ $lang = array( 'ra' => array(-2 => "Орда", -1 => "Альянс", "Обе", "Человек", "Орк", "Дворф", "Ночной эльф", "Нежить", "Таурен", "Гном", "Тролль", null, "Эльф крови", "Дреней"), 'rep' => array("Ненависть", "Враждебность", "Неприязнь", "Равнодушие", "Дружелюбие", "Уважение", "Почтение", "Превознесение"), 'st' => array( - null, "Облик кошки", "TОблик Древа жизни", "Походный облик", "Водный облик", + "По-умолчанию", "Облик кошки", "TОблик Древа жизни", "Походный облик", "Водный облик", "Облик медведя", null, null, "Облик лютого медведя", null, null, null, null, "Танец теней", null, null, "Призрачный волк", "Боевая стойка", "Оборонительная стойка", "Стойка берсерка", @@ -200,7 +220,7 @@ $lang = array( 'compare' => "Инструмент сравнения предметов", ), 'talent' => array( - 'talentCalc' => "Калькулятор Талантов", + 'talentCalc' => "Расчёт талантов", 'petCalc' => "Расчёт умений питомцев", 'chooseClass' => "Выберите класс", 'chooseFamily' => "Выберите семейство питомцев", diff --git a/pages/class.php b/pages/class.php new file mode 100644 index 00000000..4f688c25 --- /dev/null +++ b/pages/class.php @@ -0,0 +1,341 @@ + [ 26, 256, 257], + 2 => [594, 267, 184], + 3 => [ 50, 163, 51], + 4 => [253, 38, 39], + 5 => [613, 56, 78], + 6 => [770, 771, 772, 776], + 7 => [375, 373, 374], + 8 => [237, 8, 6], + 9 => [355, 354, 593], + 11 => [574, 134, 573] +); + +$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, $_id, -1, User::$localeId]); + +if (!$smarty->loadCache($cacheKeyPage, $pageData)) +{ + $cl = new CharClassList(array(['id', $_id])); + if ($cl->error) + $smarty->notFound(Lang::$game['class']); + + $infobox = []; + // hero class + if ($cl->getField('hero')) + $infobox[] = '[tooltip=tooltip_heroclass]'.Lang::$game['heroClass'].'[/tooltip]'; + + // resource + if ($_id == 11) // special Druid case + $infobox[] = Lang::$game['resources'].Lang::$colon. + '[tooltip name=powertype1]'.Lang::$game['st'][0].', '.Lang::$game['st'][31].', '.Lang::$game['st'][2].'[/tooltip][span class=tip tooltip=powertype1]'.Util::ucFirst(Lang::$spell['powerTypes'][0]).'[/span], '. + '[tooltip name=powertype2]'.Lang::$game['st'][5].', '.Lang::$game['st'][8].'[/tooltip][span class=tip tooltip=powertype2]'.Util::ucFirst(Lang::$spell['powerTypes'][1]).'[/span], '. + '[tooltip name=powertype8]'.Lang::$game['st'][1].'[/tooltip][span class=tip tooltip=powertype8]'.Util::ucFirst(Lang::$spell['powerTypes'][3]).'[/span]'; + else if ($_id == 6) // special DK case + $infobox[] = Lang::$game['resources'].Lang::$colon.'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][5]).', '.Util::ucFirst(Lang::$spell['powerTypes'][$cl->getField('powerType')]).'[/span]'; + else // regular case + $infobox[] = Lang::$game['resource'].Lang::$colon.'[span]'.Util::ucFirst(Lang::$spell['powerTypes'][$cl->getField('powerType')]).'[/span]'; + + // roles + $roles = []; + for ($i = 0; $i < 4; $i++) + if ($cl->getField('roles') & (1 << $i)) + $roles[] = (count($roles) == 2 ? '\n' : '').Lang::$game['_roles'][$i]; + + $infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$colon.implode(', ', $roles); + + // specs + $specList = []; + $skills = new SkillList(array(['id', $classSkills[$_id]])); + $skills->addGlobalsToJscript($smarty); + foreach ($skills->iterate() as $k => $__) + $specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$_id.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]'; + + $infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]'; + + $pageData = array ( + 'title' => $cl->getField('name', true).' - '.Util::ucFirst(Lang::$game['class']), + 'path' => $path, + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'relTabs' => [], + 'page' => array( + 'name' => $cl->getField('name', true), + 'talentCalc' => Util::$tcEncoding[$tcClassId[$_id] * 3], + 'icon' => 'class_'.strtolower($cl->getField('fileString')) + ) + ); + +/* + note! + newer listviews support subTabs - i.e.: + Spells => Abilities, Talents, Glyphs, Proficiencies + Items => grouping by subclass +*/ + // Quests + $conditions = array( + ['RequiredClasses', $_mask, '&'] + ); + + $quests = new QuestList($conditions); + $quests->addGlobalsToJscript($smarty); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $quests->getListviewData(), + 'params' => array( + 'sort' => "$['reqlevel', 'name']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Items + $conditions = array( + ['allowableClass', 0, '>'], + ['allowableClass', $_mask, '&'], + [['allowableClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'], + ['itemset', 0], // hmm, do or dont..? + 0 + ); + + $items = new ItemList($conditions); + $items->addGlobalsToJscript($smarty); + + if (!$items->hasDiffFields(['AllowableRace'])) + $hidden = "$['side']"; + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $items->getListviewData(), + 'params' => array( + 'id' => 'items', + 'name' => '$LANG.tab_items', + 'tabs' => '$tabsRelated', + 'visibleCols' => "$['dps', 'armor', 'slot']", + 'hiddenCols' => isset($hidden) ? $hidden : null, + 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', + 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', + 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs=4;crv=0'), + '_truncated' => 1 + ) + ); + + + + // Itemsets + $sets = new ItemsetList(array(['classMask', $_mask, '&'])); + $sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'itemset', + 'data' => $sets->getListviewData(), + 'params' => array( + 'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$_id), + 'hiddenCols' => "$['classes']", + 'sort' => "$['-level', 'name']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Trainer + $conditions = array( + ['npcflag', 0x30, '&'], // is trainer + ['trainer_type', 0], // trains class spells + ['trainer_class', $_id] + ); + + $trainer = new CreatureList($conditions); + + $pageData['relTabs'][] = array( + 'file' => 'creature', + 'data' => $trainer->getListviewData(), + 'params' => array( + 'id' => 'trainers', + 'name' => '$LANG.tab_trainers', + 'tabs' => '$tabsRelated' + ) + ); + + + // Armor Proficiencies + $conditions = array( + ['s.typeCat', -11], + ['s.skillLine1', SpellList::$skillLines[8]], + ['s.reqClassMask', $_mask, '&'] + ); + + $armorProf = new SpellList($conditions); + $armorProf->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $armorProf->getListviewData(), + 'params' => array( + 'id' => 'armor-proficiencies', + 'name' => '$LANG.tab_armorproficiencies', + 'visibleCols' => "$['type', 'classes']", + 'hiddenCols' => "$['reagents', 'skill']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Weapon Proficiencies + $conditions = array( + ['s.typeCat', -11], + ['OR', ['s.skillLine1', SpellList::$skillLines[6]], ['s.skillLine1', -3]], + ['s.reqClassMask', $_mask, '&'] + ); + + $weaponProf = new SpellList($conditions); + $weaponProf->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $weaponProf->getListviewData(), + 'params' => array( + 'id' => 'weapon-skills', + 'name' => '$LANG.tab_weaponskills', + 'visibleCols' => "$['type', 'classes']", + 'hiddenCols' => "$['reagents', 'skill']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Glyphs + $conditions = array( + ['s.typeCat', -13], + ['s.reqClassMask', $_mask, '&'] + ); + + $glyphs = new SpellList($conditions); + $glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $glyphs->getListviewData(), + 'params' => array( + 'id' => 'glyphs', + 'name' => '$LANG.tab_glyphs', + 'visibleCols' => "$['type']", + 'hiddenCols' => "$['reagents']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Abilities + $conditions = array( + ['s.typeCat', [7, -2]], + [['s.cuFlags', (SPELL_CU_TALENTSPELL | SPELL_CU_TALENT | SPELL_CU_TRIGGERED | SPELL_CU_EXCLUDE_CATEGORY_SEARCH), '&'], 0], + [ // select class by skillLine + 'OR', + ['s.skillLine1', $classSkills[$_id]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $classSkills[$_id]]] + ], + [ // last rank or unranked + 'OR', + ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], + ['s.rankId', 0] + ] + ); + + $abilities = new SpellList($conditions); + $abilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $abilities->getListviewData(), + 'params' => array( + 'id' => 'abilities', + 'name' => '$LANG.tab_abilities', + 'note' => sprintf(Util::$filterResultString, '?spells=7.'.$_id), + 'visibleCols' => "$['level', 'schools']", + 'sort' => "$['skill', 'name']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Talents + $conditions = array( + ['s.typeCat', -2], + ['cuFlags', (SPELL_CU_TALENT | SPELL_CU_TALENTSPELL), '&'], + [ // select class by skillLine + 'OR', + ['s.skillLine1', $classSkills[$_id]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $classSkills[$_id]]] + ], + [ // last rank or unranked + 'OR', + ['s.cuFlags', SPELL_CU_LAST_RANK, '&'], + ['s.rankId', 0] + ] + ); + + $talents = new SpellList($conditions); + $talents->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $talents->getListviewData(), + 'params' => array( + 'id' => "talents", + 'name' => '$LANG.tab_talents', + 'note' => sprintf(Util::$filterResultString, '?spells=-2.'.$_id), + 'visibleCols' => "$['level', 'schools', 'tier']", + 'sort' => "$['skill', 'tier']", + 'tabs' => '$tabsRelated' + ) + ); + + + // Races + $races = new CharRaceList(array(['classMask', $_mask, '&'])); + + $pageData['relTabs'][] = array( + 'file' => 'race', + 'data' => $races->getListviewData(), + 'params' => array( + 'tabs' => '$tabsRelated' + ) + ); + + $smarty->saveCache($cacheKeyPage, $pageData); +} + + +// menuId 12: Class g_initPath() +// tabId 0: Database g_initHeader() +$smarty->updatePageVars(array( + 'title' => $pageData['title'], + 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_CLASS, + 'typeId' => $_id, + // 'boardUrl' => '', //$GLOBALS['AoWoWconf']['boardUrl'] + X, + 'reqJS' => array( + 'template/js/swfobject.js' + ) +)); +$smarty->assign('community', CommunityContent::getAll(TYPE_CLASS, $_id)); // comments, screenshots, videos +$smarty->assign('lang', array_merge(Lang::$main, Lang::$talent)); +$smarty->assign('lvData', $pageData); + +// load the page +$smarty->display('class.tpl'); + +?> diff --git a/pages/classes.php b/pages/classes.php index 562a02ed..fc826ff8 100644 --- a/pages/classes.php +++ b/pages/classes.php @@ -8,9 +8,13 @@ $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, -1, -1, User::$localeId]); if (!$smarty->loadCache($cacheKey, $pageData)) { + $pageData = array( + 'listviews' => [] + ); + $classes = new CharClassList(); - $pageData = array( + $pageData['listviews'][] = array( 'file' => 'class', 'data' => $classes->getListviewData(), 'params' => [] diff --git a/pages/currencies.php b/pages/currencies.php index 302903ec..badbace4 100644 --- a/pages/currencies.php +++ b/pages/currencies.php @@ -21,9 +21,13 @@ if (isset($cat)) if (!$smarty->loadCache($cacheKey, $pageData)) { + $pageData = array( + 'listviews' => [] + ); + $money = new CurrencyList(isset($cat) ? array(['category', (int)$cat]) : []); - $pageData = array( + $pageData['listviews'][] = array( 'file' => 'currency', 'data' => $money->getListviewData(), 'params' => [] diff --git a/pages/events.php b/pages/events.php index 0d9f8606..48e74bef 100644 --- a/pages/events.php +++ b/pages/events.php @@ -48,12 +48,22 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $deps[$events->id] = $d; $pageData = array( - 'file' => 'event', - 'data' => $events->getListviewData(), - 'deps' => $deps, - 'calendar' => false, // todo (med): fix it Felix! - 'params' => array( - // 'tabs' => '$myTabs' + 'listviews' => [], + 'deps' => $deps + ); + + $pageData['listviews'][] = array( + 'file' => 'event', + 'data' => $events->getListviewData(), + 'params' => ['tabs' => '$myTabs'] + ); + + $pageData['listviews'][] = array( + 'file' => 'calendar', + 'data' => $events->getListviewData(), + 'params' => array( + 'tabs' => '$myTabs', + 'hideCount' => 1 ) ); @@ -63,18 +73,21 @@ if (!$smarty->loadCache($cacheKey, $pageData)) } // recalculate dates with now(); can't be cached, obviously -foreach ($pageData['data'] as &$data) +foreach ($pageData['listviews'] as &$views) { - // is a followUp-event - if (!empty($pageData['deps'][$data['id']])) + foreach ($views['data'] as &$data) { - $data['startDate'] = $data['endDate'] = false; - continue; - } + // is a followUp-event + if (!empty($pageData['deps'][$data['id']])) + { + $data['startDate'] = $data['endDate'] = false; + continue; + } - $updated = WorldEventList::updateDates($data['startDate'], $data['endDate'], $data['rec']); - $data['startDate'] = $updated['start'] ? date(Util::$dateFormatLong, $updated['start']) : false; - $data['endDate'] = $updated['end' ] ? date(Util::$dateFormatLong, $updated['end']) : false; + $updated = WorldEventList::updateDates($data['startDate'], $data['endDate'], $data['rec']); + $data['startDate'] = $updated['start'] ? date(Util::$dateFormatLong, $updated['start']) : false; + $data['endDate'] = $updated['end'] ? date(Util::$dateFormatLong, $updated['end']) : false; + } } diff --git a/pages/item.php b/pages/item.php index 4aa450fc..c471ea30 100644 --- a/pages/item.php +++ b/pages/item.php @@ -103,7 +103,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) {if $item.sellcopper}{$item.sellcopper}{/if} {/if} - {if isset($item.disenchantskill)}
  • {#Disenchantable#} ({$item.disenchantskill})
  • {/if} + {if isset($item.disenchantskill)}
  • {#Disenchantable#} ({$item.disenchantskill})
  • {/if} {if isset($item.key)}
  • {#Can_be_placed_in_the_keyring#}
  • {/if} diff --git a/pages/miscTools.php b/pages/miscTools.php new file mode 100644 index 00000000..aee65089 --- /dev/null +++ b/pages/miscTools.php @@ -0,0 +1,165 @@ +getRandomId(); break; + case TYPE_OBJECT: $id = (new GameobjectList(null))->getRandomId(); break; + case TYPE_ITEM: $id = (new ItemList(null))->getRandomId(); break; + case TYPE_ITEMSET: $id = (new ItemsetList(null))->getRandomId(); break; + case TYPE_QUEST: $id = (new QuestList(null))->getRandomId(); break; + case TYPE_SPELL: $id = (new SpellList(null))->getRandomId(); break; + case TYPE_ZONE: $id = (new ZoneList(null))->getRandomId(); break; + case TYPE_FACTION: $id = (new FactionList(null))->getRandomId(); break; + case TYPE_PET: $id = (new PetList(null))->getRandomId(); break; + case TYPE_ACHIEVEMENT: $id = (new AchievementList(null))->getRandomId(); break; + case TYPE_TITLE: $id = (new TitleList(null))->getRandomId(); break; + case TYPE_WORLDEVENT: $id = (new WorldEventList(null))->getRandomId(); break; + case TYPE_CLASS: $id = (new CharClassList(null))->getRandomId(); break; + case TYPE_RACE: $id = (new CharRaceList(null))->getRandomId(); break; + case TYPE_SKILL: $id = (new SkillList(null))->getRandomId(); break; + case TYPE_CURRENCY: $id = (new CurrencyList(null))->getRandomId(); break; + } + + header('Location: ?'.$page.'='.$id); + die(); + case 'latest-comments': + $menu = 2; + $lv = array( + array( + 'file' => 'commentpreview', + 'data' => [], + 'params' => [] + ) + ); + break; + case 'latest-screenshots': + $menu = 3; + $lv = array( + array( + 'file' => 'screenshot', + 'data' => [], + 'params' => [] + ) + ); + break; + case 'latest-videos': + $menu = 11; + $lv = array( + array( + 'file' => 'video', + 'data' => [], + 'params' => [] + ) + ); + break; + case 'latest-articles': + $menu = 1; + $lv = []; + break; + case 'latest-additions': + $menu = 0; + $lv = []; + break; + case 'unrated-comments': + $menu = 5; + $lv = []; + break; + case 'missing-screenshots': + $menu = 13; + $lv = []; + break; + case 'most-comments': + if ($pageParam && !in_array($pageParam, [1, 7, 30])) + header('Location: ?most-comments=1'.($_rss ? '&rss' : null)); + + if (in_array($pageParam, [7, 30])) + { + $subMenu = $pageParam; + $_title = sprintf(Lang::$main['mostComments'][1], $pageParam); + } + else + { + $subMenu = 1; + $_title = Lang::$main['mostComments'][0]; + } + + $menu = 12; + $lv = []; + break; + default: + $smarty->notFound(); +} + +if (strstr($pageCall, 'latest') || $pageCall == 'most-comments') +{ + if ($_rss) + { + header("Content-Type: application/rss+xml; charset=ISO-8859-1"); + + $xml = "\n". + "\n\t\n". + "\t\t".$AoWoWconf['page']['shortName'].' - '.Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null)."\n". + "\t\t".STATIC_URL.'?'.$pageCall . ($pageParam ? '='.$pageParam : null)."\n". + "\t\t".$AoWoWconf['page']['name']."\n". + "\t\t".implode('-', str_split(User::$localeString, 2))."\n". + "\t\t".$AoWoWconf['ttl']."\n". + // Sat, 31 Aug 2013 15:33:16 -0500 + "\t\n"; + + /* + generate 's here + */ + + $xml .= ''; + + die($xml); + } + else + $h1Links = ''.Lang::$main['subscribe'].''; +} + +$pageData = array( + 'listviews' => $lv, + 'page' => array( + 'name' => Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null), + 'h1Links' => $h1Links, + ) +); + +array_push($_path, $menu); +if ($subMenu) + array_push($_path, $subMenu); + + +// menuId 8: Utilities g_initPath() +// tabId 1: Tools g_initHeader() +$smarty->updatePageVars(array( + 'title' => Lang::$main['utilities'][$menu] . ($_title ? ' - ' . $_title : null), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 1 +)); +$smarty->assign('lang', Lang::$main); +$smarty->assign('lvData', $pageData); + +// load the page +$smarty->display('generic-no-filter.tpl'); + +?> diff --git a/pages/pets.php b/pages/pets.php index db484689..b5b7feee 100644 --- a/pages/pets.php +++ b/pages/pets.php @@ -23,6 +23,10 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $pets = new PetList(isset($cat) ? array(['type', (int)$cat]) : []); $pageData = array( + 'listviews' => [] + ); + + $lvPet = array( 'file' => 'pet', 'data' => $pets->getListviewData(), 'params' => array( @@ -31,7 +35,9 @@ if (!$smarty->loadCache($cacheKey, $pageData)) ); if (($mask = $pets->hasDiffFields(['type'])) == 0x0) - $pageData['params']['hiddenCols'] = "$['type']"; + $lvPet['params']['hiddenCols'] = "$['type']"; + + $pageData['listviews'][] = $lvPet; $pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED); diff --git a/pages/races.php b/pages/races.php index 3c79bc7f..2e9746f7 100644 --- a/pages/races.php +++ b/pages/races.php @@ -11,9 +11,13 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $races = new CharRaceList(array(['side', 0, '!'])); // only playable $pageData = array( - 'file' => 'race', - 'data' => $races->getListviewData(), - 'params' => [] + 'listviews' => array( + array( + 'file' => 'race', + 'data' => $races->getListviewData(), + 'params' => [] + ) + ) ); $smarty->saveCache($cacheKey, $pageData); diff --git a/pages/skills.php b/pages/skills.php index 120a6271..7a8bc10c 100644 --- a/pages/skills.php +++ b/pages/skills.php @@ -26,9 +26,13 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $skills = new SkillList($conditions); $pageData = array( - 'file' => 'skill', - 'data' => $skills->getListviewData(), - 'params' => [] + 'listviews' => array( + array( + 'file' => 'skill', + 'data' => $skills->getListviewData(), + 'params' => [] + ) + ) ); $smarty->saveCache($cacheKey, $pageData); diff --git a/pages/titles.php b/pages/titles.php index 59b0415d..9fbd09aa 100644 --- a/pages/titles.php +++ b/pages/titles.php @@ -23,16 +23,22 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []); $pageData = array( + 'listviews' => [] + ); + + $lvTitles = array( 'file' => 'title', 'data' => $titles->getListviewData(), 'params' => [] ); if ($titles->hasDiffFields(['category'])) - $pageData['params']['visibleCols'] = "$['category']"; + $lvTitles['params']['visibleCols'] = "$['category']"; if (!$titles->hasAnySource()) - $pageData['params']['hiddenCols'] = "$['source']"; + $lvTitles['params']['hiddenCols'] = "$['source']"; + + $pageData['listviews'][] = $lvTitles; $smarty->saveCache($cacheKey, $pageData); } diff --git a/pages/zones.php b/pages/zones.php index 460b232e..ac743ba4 100644 --- a/pages/zones.php +++ b/pages/zones.php @@ -58,11 +58,15 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $zones = new ZoneList($conditions); $pageData = array( - 'file' => 'zone', - 'data' => $zones->getListviewData(), - 'som' => '', - 'map' => [], - 'params' => [] + 'som' => '', + 'map' => [], + 'listviews' => array( + array( + 'file' => 'zone', + 'data' => $zones->getListviewData(), + 'params' => [] + ) + ) ); if ($mapFile) diff --git a/setup/aowow_articles_u1.sql b/setup/aowow_articles_u1.sql new file mode 100644 index 00000000..b3aa02b4 --- /dev/null +++ b/setup/aowow_articles_u1.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS `aowow_article_items`; +REPLACE INTO `aowow_articles` VALUES + (1300001,13,1,0,'[b][color=c1]Warriors[/color][/b] are a very powerful class, with the ability to tank or deal significant melee damage. The warrior\'s Protection tree contains many talents to improve their survivability and generate threat versus monsters. Protection warriors are one of the main tanking classes of the game.\\n\\nThey also have two damage-oriented talent trees - [icon name=ability_rogue_eviscerate][url=spells=7.1.26]Arms[/url][/icon] and [icon name=ability_warrior_innerrage][url=spells=7.1.256]Fury[/url][/icon], the latter of which includes the talent [spell=46917], which allows the warrior to wield two two-handed weapons at the same time! They are capable of strong melee AoE damage with spells such as [spell=845], [spell=1680], [spell=46924]. A warrior fights while in a specific [i]stance[/i], which grants him bonuses and access to different sets of abilities. He will use [spell=71] for tanking, and [spell=2457] or [spell=2458] for melee DPS.\\n\\n[ul]\\n[li]All warriors can buff their raid or group by using a [i]shout[/i], [spell=6673] or [spell=469], and Fury warriors can provide the passive buff [spell=29801] which significantly increases the melee and ranged critical strike chance of his allies.[/li]\\n[li]Warriors start out with only [spell=2457] at first, but learn [spell=71] at level 10 and [spell=2458] at level 30.[/li]\\n[li]Warriors have numerous useful methods of getting to their target in a hurry! All warriors can use [spell=100] or [spell=20252] to reach an enemy and Protection warriors have [spell=3411], which allows them to intercept a friendly target and protect them from an attack.[/li]\\n[/ul]',NULL), + (1300002,13,2,0,'[b][color=c2]Paladins[/color][/b] bolster their allies with holy auras and blessing to protect their friends from harm and enhance their powers. Wearing heavy armor, they can withstand terrible blows in the thickest battles while healing their wounded allies and resurrecting the slain. In combat, they can wield massive two-handed weapons, stun their foes, destroy undead and demons, and judge their enemies with holy vengeance. Paladins are a defensive class, primarily designed to outlast their opponents.\\n\\nThe paladin is a mix of a melee fighter and a secondary spell caster. The paladin has a great deal of group utility due to the paladin\'s healing, blessings, and other abilities. Paladins can have one active aura per paladin on each party member and use specific blessings for specific players. Paladins are pretty hard to kill, thanks to their assortment of defensive abilities. They also make excellent tanks using their [spell=25780] ability.\\n\\n[ul]\\n[li]Can effectively heal, tank, and deal damage in melee.[/li]\\n[li]Has a wide selection of [url=spells=7.2&filter=na=blessing]Blessings[/url], [url=spells=7.2&filter=na=aura]Auras[/url], and other buffs.[/li]\\n[li]Is the only class with access to a true invulnerability spell: [spell=642][/li]\\n[/ul]',NULL), + (1300003,13,3,0,'[b][color=c3]Hunters[/color][/b] are a very unique class in World of Warcraft. They are the sole non-magical ranged damage-dealers, fighting with bows and guns. Hunters have a number of different kinds of shots and stings, which can be used to debuff an enemy, and are capable of laying traps to deal damage or otherwise slow/incapacitate their enemy.\\n\\nA hunter will also tame his very own [url=pets]pet[/url] to aid them in combat. While they are not the only class which can use pet minions, the hunter\'s pet is unique in that each species has a particular type of talent tree, which the hunter can use to distribute points into various skills and passive abilities.\\n\\nIn addition, each species has a unique special ability. Hunters can seek out the most desirable pets based on their appearances or abilities, and if they spec deep enough into the [icon name=ability_hunter_beasttaming][url=spells=7.3.50]Beast Mastery[/url][/icon] tree they gain access to special, \\\"exotic\\\" beasts such as [pet=46] or [pet=39]!\\n\\n[ul]\\n[li]Hunters have access to 23 (32 if [icon name=ability_hunter_beasttaming][url=spells=7.3.50]Beast Mastery[/url][/icon]) different [url=pets]species of pets[/url], featuring over 150 different appearances![/li]\\n[li]Hunters have a number of survival-oriented skills which they can use to escape or avoid potential danger, such as [spell=5384] and [spell=781].[/li]\\n[li][icon name=ability_hunter_swiftstrike][url=spells=7.3.51]Survival[/url][/icon] hunters can spec down the tree into [spell=53292], which allows them to provide the [spell=57669] buff to their party and raid members.[/li]\\n[/ul]',NULL), + (1300004,13,4,0,'[b][color=c4]Rogues[/color][/b] are a leather-clad melee class capable of dealing large amounts of damage to their enemies with very fast attacks. They are masters of stealth and assassination, passing by enemies unseen and striking from the shadows, then escaping from combat in the blink of an eye.\\n\\nThey are capable of using poisons to cripple their opponents, massively weakening them in battle. Rogues have a powerful arsenal of skills, many of which are strengthened by their ability to stealth and to incapacitate their victims.\\n[ul]\\n[li]Rogues can use a wide variety of melee weapons, such as daggers, fist weapons, one-handed maces, one-handed swords and one-handed axes.[/li]\\n[li]By coating their weapons with [url=items=0.-3&filter=na=poison;ub=4]poison[/url] rogues can severely cripple or weaken their enemies.[/li]\\n[li]When using [spell=1784] rogues will be unseen except by the most perceptive enemies.[/li]\\n[/ul]','[ul][li]Resource: [span]Energy[/span][/li][li]Role: Melee DPS[/li][li]Specs: [ul][li][icon name=Ability_Rogue_Eviscerate][url=spells=7.4.253]Assassination[/url][/icon][/li][li][icon name=Ability_BackStab][url=spells=7.4.38]Combat[/url][/icon][/li][li][icon name=Ability_Stealth][url=spells=7.4.39]Subtlety[/url][/icon][/li][/ul][/li][/ul]'), + (1300005,13,5,0,'[b][color=c5]Priests[/color][/b] are commonly considered one of the standard healing classes in World of Warcraft, as they have two talent specs that can be used to heal quite effectively.\\n\\nTheir [icon name=spell_holy_holybolt][url=spells=7.5.56]Holy[/url][/icon] tree includes talents which strongly boost the healing done to their allies, including spells that can be used to heal multiple players at once, such as [spell=48089]. The [icon name=spell_holy_wordfortitude][url=spells=7.5.613]Discipline[/url][/icon] tree, while still capable of significant raw healing output, focuses primarily on damage absorption and mitigation through use of [spell=48066] and procced shielding effects. Priests are also capable of very powerful ranged damage with their unique [icon name=spell_shadow_shadowwordpain][url=spells=7.5.78]Shadow[/url][/icon] abilities, and upon entering [spell=15473] will see a significant increase in their shadow damage while losing the ability to cast any Holy spells.\\n\\n[ul]\\n[li]While the [icon name=spell_holy_wordfortitude][url=spells=7.5.613]Discipline[/url][/icon] talent tree is commonly used for healing, it also contains some powerful talents that can boost the priest\'s Holy damage, though [icon name=spell_shadow_shadowwordpain][url=spells=7.5.78]Shadow[/url][/icon] spells and abilities should be used primarily for DPS.[/li]\\n[li]Priests provide of the most appreciated buffs in the game - [spell=48161], which grants an indispensable stamina buff to everyone in the raid. They can also buff both [spell=48073] and [spell=48169]![/li]\\n[li]Shadow priests are an excellent utility class for any raid, providing the much-loved [spell=57669] buff to boost mana regeneration and can even heal their own party with [spell=15286]![/li]\\n[/ul]',NULL), + (1300006,13,6,0,'Introduced in the Wrath of the Lich King expansion, [b][color=c6]Death Knights[/color][/b] are World of Warcraft\'s first hero class. Death knights start at level 55 in a special, instanced zone unreachable by any other class: Acherus, the Ebon Hold, located in [zone=4298]. Here they will earn their talent points as quest rewards and even get a special summoned mount, the [spell=48778]!\\n\\nDeath knights have multiple very strong damage dealing options, as each of their talent trees can be specced to perform exceptionally well with a variety of melee abilities, spells and damage-over-time dealing diseases. They are also very capable tank classes, with both their Blood and Frost trees providing unique options - [icon name=spell_deathknight_bloodboil][url=spells=7.6.770]Blood[/url][/icon] dealing more with self-healing abilities and [icon name=spell_frost_frostnova][url=spells=7.6.771]Frost[/url][/icon] providing significant damage mitigation and strong AoE damage.\\n\\nDeath knights fight with a special buff active called a [i]presence[/i] (similar to a warrior\'s stances) which provides special bonuses to their roles. Death knights utilize a unique power system, with most spells costing either Runes, which are replenished throughout battle, or Runic Power, which can be generated by various abilities.\\n\\n[ul]\\n[li][icon name=spell_deathknight_armyofthedead][url=spells=7.6.772]Unholy[/url][/icon] death knights can spec into [spell=52143], which makes their summoned Ghoul minion a permanent pet to aid in battle![/li]\\n[li]The death knight class has its own special weapon enchanting ability called [spell=53428], which replaces the need for conventional weapon enchants.[/li]\\n[li]Death knights are a very unique damage-dealing class in that their damage is dealt by both melee abilities [i]and[/i] spells![/li]\\n[/ul]',NULL), + (1300007,13,7,0,'[b][color=c7]Shamans[/color][/b] master elemental and nature magics and bring the most potential buffs to any group in the form of totems. A shaman can summon one totem of each element - earth, fire, air, and water - which appears at the shaman\'s feet and provides a buff to anyone in the shaman\'s party or raid within range of it. Some shaman totems, notably the fire ones, also do damage to opponents. The trick to playing any type of shaman is knowing which totems to cast under which circumstances to maximize the group\'s damage output and survivability.\\n\\nShamans are primarily spellcasters, although an [icon name=spell_nature_lightningshield][url=spells=7.7.373]Enhancement[/url][/icon] shaman likes to get close and personal and do damage within melee range. An enhancement shaman learns to [spell=30798] weapons and can use [spell=51533] to summon a pair of Spirit Wolves to aid in battle. Despite being primarily melee, [icon name=spell_nature_lightningshield][url=spells=7.7.373]Enhancement[/url][/icon] shamans can still gain some benefit from spellpower and can cast instant [spell=403] or heals with [spell=51530]. \\n\\n[icon name=spell_nature_lightning][url=spells=7.7.375]Elemental[/url][/icon] shamans stand back and cast fire and lightning spells to deal great amounts of damage. They can push back enemies with [spell=51490] and root all enemies in an area with[spell=51486]. They also bring [icon name=spell_fire_totemofwrath][url=spell=57722]Totem of Wrath[/url][/icon] and [spell=51470] as amazing spellcaster raid buffs. A shaman that choses [icon name=spell_nature_magicimmunity][url=spells=7.7.374]Restoration[/url][/icon] gains improved healing spells and can be a great raid or tank healer. Resto shamans are known for their powerful [spell=1064] ability and for providing a [spell=16190] to help their party\'s mana restoration. They also gain a powerful [spell=974], can use [spell=51886] to remove curses, and have an instant-cast direct heal plus heal over time effect called [spell=61295].\\n\\n[ul]\\n[li]There are over twenty different totems a shaman can learn![/li]\\n[li]Shamans can cast [spell=2825] (or [spell=32182]) to boost the entire group\'s damage and healing. This buff is unique and oft sought after for a raid group.[/li]\\n[li]A shaman can turn into a [spell=2645] at level 16 and can even make it instant cast with [spell=16287]. This spell can be used in combat, but not indoors.[/li]\\n[li]Shamans can only have one elemental shield - [spell=324] or [spell=52127] - on at a time. [spell=974], if the shaman knows it, can be cast on another player.[/li]\\n[/ul]',NULL), + (1300008,13,8,0,'[b][color=c8]Mages[/color][/b] wield the elements of fire, frost, and arcane to destroy or neutralize their enemies. They are a robed class that excels at dealing massive damage from afar, casting elemental bolts at a single target, or raining destruction down upon their enemies in a wide area of effect. Mages can also augment their allies\' spell-casting powers, summon food or drink to restore their friends, and even travel across the world in an instant by opening arcane portals to distant lands.\\n\\nWhen seeking someone to introduce monsters to a world of pain, the Mage is a good choice. With their elemental and arcane attacks, it\'s a safe bet something they can do won\'t be resisted by your chosen enemy. Damage is the name of the Mage game, and they do it well. Their arsenal includes some powerful buffs, debuffs, stuns, and snares, enabling them to dictate the terms of any fight.\\n\\n[ul]\\n[li]Can [spell=42956] to restore their allies\' health and mana.[/li]\\n[li]Are the only class that can create portals to transport other players. They cannot, however, summon players [i]from[/i] a distant location - that\'s a [icon name=class_warlock][color=c9]Warlock\'s[/color][/icon] job![/li]\\n[li]Mages who use [item=50045] can have a permanent water elemental pet![/li]\\n[/ul]',NULL), + (1300009,13,9,0,'[b][color=c9]Warlocks[/color][/b] are masters of the demonic arts. Clothed in demonic styled cloth, they excel in using curses, firing bolts of fire or shadow, and summoning demons to help them in combat. Warlocks, while being excellent spell casters, also excel in supporting fellow allies by summoning other players or using ritual magics to conjure stones imbued with the power to heal.\\n\\nA warlock has very powerful abilities that, if used correctly, make them a very formidable opponent. Using their curses in combination with direct damage spells, Warlocks wreak havoc and destruction.\\n\\n[ul][li]Can use a [spell=698] to summon another player to the portals location.[/li]\\n[li]Are able to conjure [icon name=inv_stone_04][url=item=5509]Healthstones[/url][/icon] that have the ability to heal the user.[/li]\\n[li]Can use curses on enemies to [url=spell=47865]weaken[/url] them or [url=spell=47864]damage[/url] them.[/li][/ul]',NULL), + (1300011,13,11,0,'[b][color=c11]Druids[/color][/b] are World of Warcraft\'s \\\"jack of all trades\\\" class -- that is, capable of performing in a variety of different roles and as such have one of the most varied playstyles. A druid can act as a healer, melee DPS, ranged DPS or a tank, utilizing a variety of [i]shapeshifting[/i] forms. As a druid levels up, he is able to learn new, powerful forms which he can cast to change into different creatures to suit their roles.\\n\\nAt lower levels, a druid will heal or ranged DPS in his caster form, but at later levels players who spec into the specialized trees will gain access to two special shapeshift forms for each different role.\\n\\nHealing druids will learn [spell=33891], which reduces the mana cost of their healing spells and grants a passive healing aura to their allies. Their ranged damage-dealing counterparts will learn [spell=24858], increasing their armor and granting a spell critical aura to their allies. There are also two feral form druid forms -- the mighty [spell=5487] (and at later level, [spell=9634]), a tanking-oriented form which provides additional armor and health and grants access to an arsenal of threat-building and damage mitigation abilities, and the rogue-like [spell=768] which is capable of significant melee DPS.\\n\\n[ul]\\n[li]Druids learn their different forms through questing or training. Some shapeshifts are only learned via talents.[/li]\\n[li]There are some shapeshifts that all druids can learn. [spell=5487] is obtained at level 10, [spell=1066] and [spell=783] at level 16, [spell=768] at level 20 and [spell=9634] at level 40.[/li]\\n[li]Druids even have their own flying travel form! [spell=33943] can be trained at level 60, and [spell=40120] at level 71 provided the player has already trained [spell=34091].[/li]\\n[li]Some druid shapeshifts are obtained via talents only - [spell=24858] can be obtained at level 40 when a player specs deep into the [icon name=spell_nature_starfall][url=spells=7.11.574]Balance[/url][/icon] tree, and [spell=33891] at level 50 after speccing deep into [icon name=spell_nature_healingtouch][url=spells=7.11.573]Restoration[/url][/icon].[/li]\\n[li]Druids have their own, class-specific teleport ability that allows them to travel to and from [zone=493], which is handy when needing to train![/li]\\n[li]Because feral druids do not actually swing weapons while in shapeshift forms, they instead gain a special statistic from any melee weapon they equip called \\\"feral attack power.\\\" This stat is a conversion of a weapon\'s DPS (damage per second) into an attack power-granting statistic which affects the cat or bear\'s damage output.[/li]\\n[/ul]',NULL); diff --git a/template/achievement.tpl b/template/achievement.tpl index fdf59c29..458a53e7 100644 --- a/template/achievement.tpl +++ b/template/achievement.tpl @@ -16,13 +16,13 @@ g_initPath({$page.path}); //]]> -{* include file='bricks/infobox.tpl' *} +{* include file='bricks/infobox.tpl' info=$lvData.infobox *} @@ -64,7 +64,7 @@ {if isset($filter.setCr)}{$filter.setCr}{/if} //]]> -
    +
    diff --git a/template/bricks/article.tpl b/template/bricks/article.tpl index d47e96ac..bf0d4826 100644 --- a/template/bricks/article.tpl +++ b/template/bricks/article.tpl @@ -1,7 +1,13 @@ {if !empty($article)}
    diff --git a/template/bricks/globals/pets.tpl b/template/bricks/globals/pets.tpl new file mode 100644 index 00000000..0a757332 --- /dev/null +++ b/template/bricks/globals/pets.tpl @@ -0,0 +1,8 @@ +var _ = g_pets; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + icon:'{$item.icon|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/zones.tpl b/template/bricks/globals/zones.tpl new file mode 100644 index 00000000..eaf93532 --- /dev/null +++ b/template/bricks/globals/zones.tpl @@ -0,0 +1,8 @@ +var _ = g_gatheredzones; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/infobox.tpl b/template/bricks/infobox.tpl index 8002f0c7..cbb3be82 100644 --- a/template/bricks/infobox.tpl +++ b/template/bricks/infobox.tpl @@ -1,5 +1,5 @@
    {$lang.quickFacts}
      - {if $lvData.page.points}
    • {$lang.points}: {$lvData.page.points}
    • {/if} + {if $lvData.page.points}
    • {$lang.points}: {$lvData.page.points}
    • {/if} {foreach from=$lvData.infobox item=info}
    • {$info}
    • {/foreach} diff --git a/template/achievements.tpl b/template/achievements.tpl index 0892478b..9a500ee1 100644 --- a/template/achievements.tpl +++ b/template/achievements.tpl @@ -26,7 +26,7 @@ - +
         
    -{if !empty($lvData.infobox)} +{if !empty($info)} {/if} @@ -14,8 +14,8 @@ {if $user.id > 0} {/if} -{if !empty($lvData.infobox)} +{if !empty($info)} {/if} \ No newline at end of file diff --git a/template/bricks/listviews/achievement.tpl b/template/bricks/listviews/achievement.tpl index 521943d1..6525f093 100644 --- a/template/bricks/listviews/achievement.tpl +++ b/template/bricks/listviews/achievement.tpl @@ -3,7 +3,7 @@ template:'achievement', {if !isset($params.id)}id:'achievements',{/if} {if !isset($params.name)}name:LANG.tab_achievements,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/calendar.tpl b/template/bricks/listviews/calendar.tpl index b6234459..25932b43 100644 --- a/template/bricks/listviews/calendar.tpl +++ b/template/bricks/listviews/calendar.tpl @@ -3,7 +3,7 @@ template:'holidaycal', {if !isset($params.id)}id:'calendar',{/if} {if !isset($params.name)}name:LANG.tab_calendar,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/class.tpl b/template/bricks/listviews/class.tpl index e9e0f35b..48ce097a 100644 --- a/template/bricks/listviews/class.tpl +++ b/template/bricks/listviews/class.tpl @@ -3,7 +3,7 @@ template:'classs', {if !isset($params.id)}id:'classes',{/if} {if !isset($params.name)}name:LANG.tab_classes,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/commentpreview.tpl b/template/bricks/listviews/commentpreview.tpl new file mode 100644 index 00000000..5baaa00c --- /dev/null +++ b/template/bricks/listviews/commentpreview.tpl @@ -0,0 +1,30 @@ +{strip} + new Listview({ldelim} + template: 'commentpreview', + id: 'comments', + {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} + id:{$curr.id}, + user:'{$curr.user|escape:"javascript"}', + date:'{$curr.date|date_format:"%Y/%m/%d %H:%M:%S"}', + preview:'{$curr.preview|escape:"javascript"}', + subject:'{$curr.subject|escape:"javascript"}', + rating: {$curr.rating}, + deleted:{$curr.deleted}, + type:{$curr.type}, + typeId:{$curr.typeId} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/listviews/creature.tpl b/template/bricks/listviews/creature.tpl index ecbaa36a..b8a79c86 100644 --- a/template/bricks/listviews/creature.tpl +++ b/template/bricks/listviews/creature.tpl @@ -3,7 +3,7 @@ template:'npc', {if !isset($params.id)}id:'npcs',{/if} {if !isset($params.name)}name:LANG.tab_npcs,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach name=params from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/currency.tpl b/template/bricks/listviews/currency.tpl index 15997a4b..60363d09 100644 --- a/template/bricks/listviews/currency.tpl +++ b/template/bricks/listviews/currency.tpl @@ -3,7 +3,7 @@ template:'currency', {if !isset($params.id)}id:'currencies',{/if} {if !isset($params.name)}name:LANG.tab_currencies,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/event.tpl b/template/bricks/listviews/event.tpl index 20af898c..aa887817 100644 --- a/template/bricks/listviews/event.tpl +++ b/template/bricks/listviews/event.tpl @@ -3,7 +3,7 @@ template:'holiday', {if !isset($params.id)}id:'holidays',{/if} {if !isset($params.name)}name:LANG.tab_holidays,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/item.tpl b/template/bricks/listviews/item.tpl index a1544b78..40576739 100644 --- a/template/bricks/listviews/item.tpl +++ b/template/bricks/listviews/item.tpl @@ -3,7 +3,7 @@ template:'item', {if !isset($params.id)}id:'items',{/if} {if !isset($params.name)}name:LANG.tab_items,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/itemset.tpl b/template/bricks/listviews/itemset.tpl index 0a934b4a..795b9d62 100644 --- a/template/bricks/listviews/itemset.tpl +++ b/template/bricks/listviews/itemset.tpl @@ -3,7 +3,7 @@ template:'itemset', {if !isset($params.id)}id:'itemsets',{/if} {if !isset($params.name)}name:LANG.tab_itemsets,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/model.tpl b/template/bricks/listviews/model.tpl index 95f3a9b8..03863de8 100644 --- a/template/bricks/listviews/model.tpl +++ b/template/bricks/listviews/model.tpl @@ -3,7 +3,7 @@ template:'model', {if !isset($params.id)}id:'gallery',{/if} {if !isset($params.name)}name:LANG.tab_gallery,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/pet.tpl b/template/bricks/listviews/pet.tpl index ff4b7c17..e345a700 100644 --- a/template/bricks/listviews/pet.tpl +++ b/template/bricks/listviews/pet.tpl @@ -21,7 +21,7 @@ var _ = function(family) computeDataFunc: _, {if !isset($params.id)}id:'hunter-pets',{/if} {if !isset($params.name)}name:LANG.tab_pets,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/quest.tpl b/template/bricks/listviews/quest.tpl index 956c137b..b482ea55 100644 --- a/template/bricks/listviews/quest.tpl +++ b/template/bricks/listviews/quest.tpl @@ -3,7 +3,7 @@ template:'quest', {if !isset($params.id)}id:'quests',{/if} {if !isset($params.name)}name:LANG.tab_quests,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/race.tpl b/template/bricks/listviews/race.tpl index af52a7d8..f050fb2f 100644 --- a/template/bricks/listviews/race.tpl +++ b/template/bricks/listviews/race.tpl @@ -3,7 +3,7 @@ template:'race', {if !isset($params.id)}id:'races',{/if} {if !isset($params.name)}name:LANG.tab_races,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/screenshot.tpl b/template/bricks/listviews/screenshot.tpl new file mode 100644 index 00000000..09ff4481 --- /dev/null +++ b/template/bricks/listviews/screenshot.tpl @@ -0,0 +1,30 @@ +{strip} + new Listview({ldelim} + template: 'screenshot', + id: 'screenshots', + {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} + id:{$curr.id}, + user:'{$curr.user|escape:"javascript"}', + date:'{$curr.date|date_format:"%Y/%m/%d %H:%M:%S"}', + caption:'{$curr.caption|escape:"javascript"}', + subject:'{$curr.subject|escape:"javascript"}', + width:{$curr.width}, + height:{$curr.height}, + type:{$curr.type}, + typeId:{$curr.typeId} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/listviews/skill.tpl b/template/bricks/listviews/skill.tpl index 1abf92f1..afe3e513 100644 --- a/template/bricks/listviews/skill.tpl +++ b/template/bricks/listviews/skill.tpl @@ -3,7 +3,7 @@ template:'skill', {if !isset($params.id)}id:'skills',{/if} {if !isset($params.name)}name:LANG.tab_skills,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/spell.tpl b/template/bricks/listviews/spell.tpl index 8a03574a..2d901ccd 100644 --- a/template/bricks/listviews/spell.tpl +++ b/template/bricks/listviews/spell.tpl @@ -3,7 +3,7 @@ template:'spell', {if !isset($params.id)}id:'spells',{/if} {if !isset($params.name)}name:LANG.tab_spells,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/title.tpl b/template/bricks/listviews/title.tpl index 87e26ef7..de03025d 100644 --- a/template/bricks/listviews/title.tpl +++ b/template/bricks/listviews/title.tpl @@ -3,7 +3,7 @@ template:'title', {if !isset($params.id)}id:'titles',{/if} {if !isset($params.name)}name:LANG.tab_titles,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/listviews/video.tpl b/template/bricks/listviews/video.tpl new file mode 100644 index 00000000..ffd510c0 --- /dev/null +++ b/template/bricks/listviews/video.tpl @@ -0,0 +1,32 @@ +{strip} + new Listview({ldelim} + template: 'video', + id: 'videos', + {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} + id:{$vi.id}, + user:'{$vi.user}', + date:'{$vi.date|date_format:"%Y/%m/%d %H:%M:%S"}', + videoType:1, {* there is only youtube *} + videoId:'{$vi.videoId}', + type:{$page.type}, + typeId:{$page.typeId}, + {if isset($vi.sticky)} + sticky:{$vi.sticky}, + {/if} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} + diff --git a/template/bricks/listviews/zone.tpl b/template/bricks/listviews/zone.tpl index 7cbba785..88fb0841 100644 --- a/template/bricks/listviews/zone.tpl +++ b/template/bricks/listviews/zone.tpl @@ -3,7 +3,7 @@ template:'zone', {if !isset($params.id)}id:'zones',{/if} {if !isset($params.name)}name:LANG.tab_zones,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} {foreach from=$params key=k item=v} {if $v[0] == '$'} {$k}:{$v|substr:1}, diff --git a/template/bricks/tabsRelated.tpl b/template/bricks/tabsRelated.tpl index fce62691..80474d83 100644 --- a/template/bricks/tabsRelated.tpl +++ b/template/bricks/tabsRelated.tpl @@ -1,5 +1,5 @@
    -
    +
    diff --git a/template/class.tpl b/template/class.tpl new file mode 100644 index 00000000..8101643d --- /dev/null +++ b/template/class.tpl @@ -0,0 +1,44 @@ +{include file='header.tpl'} + +
    +
    +
    + +{if !empty($announcements)} + {foreach from=$announcements item=item} + {include file='bricks/announcement.tpl' an=$item} + {/foreach} +{/if} + + + +{include file='bricks/infobox.tpl' info=$lvData.infobox} + +
    +
    + + WowheadWowhead + {$lang.links}{$lang.links} + {$lang.talentCalc}{$lang.talentCalc} + {$lang.forum}{$lang.forum} +

    {$lvData.page.name}

    + +{include file='bricks/article.tpl'} + +

    {$lang.related}

    +
    + +{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} + +{include file='bricks/contribute.tpl'} + +
    +
    + +{include file='footer.tpl'} diff --git a/template/css/global.css b/template/css/global.css index 0555a0bd..8ab31130 100644 --- a/template/css/global.css +++ b/template/css/global.css @@ -148,10 +148,10 @@ a.selected, a.selected:hover .text h1 { color: white; - font-size: 20px; + font-size: 19px; font-weight: normal; border-bottom: 1px solid #505050; - padding: 0 0 5px; + padding: 1px 0 5px; margin: 0 0 13px; line-height: 1.1em; } @@ -721,93 +721,93 @@ span.breadcrumb-ellipsis { /********/ .menu { - position: absolute; - z-index: 100000002; + position: absolute; + z-index: 100000002; } .menu .menu-outer { - float: left; - border: 1px solid #181818; + float: left; + border: 1px solid #181818; - -webkit-box-shadow: 1px 1px 5px black; - -moz-box-shadow: 1px 1px 5px black; - box-shadow: 1px 1px 5px black; + -webkit-box-shadow: 1px 1px 5px black; + -moz-box-shadow: 1px 1px 5px black; + box-shadow: 1px 1px 5px black; } .menu .menu-inner { - border: 2px solid #484848; - border-top: 1px solid #484848; + border: 2px solid #484848; + border-top: 1px solid #484848; } .menu a { - display: block; - padding: 4px 4px 4px 24px; - text-decoration: none; - border-top: 1px solid #484848; - border-bottom: 1px solid #101010; - white-space: nowrap; - font-size: 13px; + display: block; + padding: 4px 4px 4px 24px; + text-decoration: none; + border-top: 1px solid #484848; + border-bottom: 1px solid #101010; + white-space: nowrap; + font-size: 13px; } .menu a span { - display: block; - padding-right: 20px; + display: block; + padding-right: 20px; } .menu a span.hassubmenu { - background: url(../images/Menu/arrow-right.gif) right center no-repeat; + background: url(../images/Menu/arrow-right.gif) right center no-repeat; } .menu a, .menu a span { /* Setting the background color on both the and the so the hover effect works in IE7 */ - background-color: #282828; + background-color: #282828; } .menu a.open, .menu a:hover, .menu a.open span, .menu a:hover span { - background-color: #383838; + background-color: #383838; } .menu a.open, .menu a:hover { - border-bottom: 1px solid #202020; + border-bottom: 1px solid #202020; } .menu a.separator { - color: white; - font-weight: bold; - padding: 4px 8px; - background-color: #181818; + color: white; + font-weight: bold; + padding: 4px 8px; + background-color: #181818; } .menu a.separator:hover { - text-decoration: underline; - background-color: #181818; - border-bottom: 1px solid #101010; + text-decoration: underline; + background-color: #181818; + border-bottom: 1px solid #101010; } .menu a.unlinked { - text-decoration: none !important; - cursor: default; + text-decoration: none !important; + cursor: default; } .menu a.checked { - background-image: url(../images/Menu/check.gif); - background-position: 9px center; - background-repeat: no-repeat; + background-image: url(../images/Menu/check.gif); + background-position: 9px center; + background-repeat: no-repeat; } .menu a.icon, .menu a.tinyicon { - background-position: 4px center; - background-repeat: no-repeat; - padding-left: 24px; + background-position: 4px center; + background-repeat: no-repeat; + padding-left: 24px; } .menu a.socket-meta, .menu a.socket-red, .menu a.socket-yellow, .menu a.socket-blue, .menu a.socket-prismatic, .menu a.socket-hydraulic, .menu a.socket-cogwheel { - background-position: 5px center; + background-position: 5px center; } .menu a.icon-star-right span { - padding-right: 21px; - background: url(../images/icons/star.png) no-repeat right center; + padding-right: 21px; + background: url(../images/icons/star.png) no-repeat right center; } /****************/ @@ -815,35 +815,35 @@ span.breadcrumb-ellipsis { /****************/ .menu-buttons { - padding: 4px 0 0 5px; + padding: 4px 0 0 5px; } span.menu-buttons a { - text-decoration: none; - color: white; - padding: 4px 11px; - font-size: 13px; - white-space: nowrap; + text-decoration: none; + color: white; + padding: 4px 11px; + font-size: 13px; + white-space: nowrap; } span.menu-buttons a:hover { - text-decoration: underline; + text-decoration: underline; } span.menu-buttons a.open { - background-color: #484848; - padding: 3px 10px; - border: 1px solid #282828; + background-color: #484848; + padding: 3px 10px; + border: 1px solid #282828; } span.menu-buttons a.unlinked { - text-decoration: none !important; - cursor: default; + text-decoration: none !important; + cursor: default; } span.menu-buttons span.hassubmenu { - padding-right: 13px; - background: url(../images/Menu/arrow-down.gif) right center no-repeat; + padding-right: 13px; + background: url(../images/Menu/arrow-down.gif) right center no-repeat; } /* start note: remove with breadcrumbs */ @@ -1390,6 +1390,18 @@ a.star-icon-right span padding-left: 13px !important; } +.bubble-icon +{ + background: url(../images/bubble.gif) left center no-repeat; + padding-left: 22px; +} + +.bubble-icon-right +{ + background: url(../images/bubble.gif) right center no-repeat; + padding-right: 22px; +} + .instance-icon1, .instance-icon2, .instance-icon3, .instance-icon4, .instance-icon5, .instance-icon7 { background: url(../../images/icons/instance-icons.gif) no-repeat; @@ -1754,7 +1766,7 @@ a.star-icon-right span .listview-band-top, .listview-band-bottom { background-color: #404040; - color: #ccc; + color: #cccccc; } .listview-band-top @@ -1764,13 +1776,14 @@ a.star-icon-right span .listview-band-bottom { - padding: 6px 6px 3px 3px; + padding: 6px 3px 3px 3px; } -.listview-band-top input, .listview-band-bottom input, .listview-band-top select, .listview-band-bottom select +.listview-band-top input, .listview-band-bottom input, +.listview-band-top select, .listview-band-bottom select { font-size: 11px; - margin-right: .5em; + margin-right: 0.5em; } .listview-quicksearch @@ -1795,7 +1808,7 @@ a.star-icon-right span display: block; width: 12px; height: 12px; - background: url(../images/search2.gif) no-repeat; + background: url(../images/Listview/quicksearch-cancel.gif) no-repeat; } .listview-quicksearch a:hover span @@ -1811,7 +1824,7 @@ a.star-icon-right span top: 2px; width: 13px; height: 13px; - background: url(../images/search4.gif) no-repeat; + background: url(../images/Listview/quicksearch.gif) no-repeat; } .listview-quicksearch input @@ -1828,12 +1841,15 @@ a.star-icon-right span .listview-withselected { + /* Top bar */ + clear: left; padding-left: 33px; - background: url(../images/listview-withselected.gif) 11px 6px no-repeat; + background: url(../images/Listview/withselected.gif) 11px 6px no-repeat; } .listview-withselected2 { + /* Bottom bar */ padding-left: 33px; background: url(../images/listview-withselected.gif) 11px -35px no-repeat; } @@ -1847,7 +1863,7 @@ a.star-icon-right span .listview-nav a, .listview-nav span { - margin-left: .5em; + margin-left: 0.5em; } .listview-note @@ -1855,6 +1871,12 @@ a.star-icon-right span line-height: 16px; } +.listview table +{ + width: 100%; + border-collapse: collapse; +} + .listview th { font-size: 14px; @@ -1863,6 +1885,11 @@ a.star-icon-right span border-bottom: 1px solid #202020; } +.listview .iconlist th +{ + border: none; +} + .listview thead div { position: relative; @@ -1875,7 +1902,7 @@ a.star-icon-right span .listview thead a { display: block; - padding: 4px 0; + padding: 5px 2px; text-decoration: none; color: white; background-color: #585858; @@ -1886,22 +1913,54 @@ a.star-icon-right span padding: 0 4px; } +.listview thead a span span +{ + padding: 0; +} + .listview th a:hover { background-color: #606060; } -.listview-mode-default, .listview-mode-div, .listview-mode-tiled +.listview th a.static +{ + cursor: default; +} + +.listview th a.static:hover +{ + background-color: #585858; +} + +.listview-mode-default, .listview-mode-div, .listview-mode-tiled, .listview-mode-calendar { background-color: #141414; } +.listview-mode-default th +{ + white-space: nowrap; +} + .listview-mode-default td { padding: 4px; - color: #ddd; + color: #dddddd; text-align: center; border: 1px solid #404040; + font-size: 13px; +} + +.listview-clip td +{ + border: none; + border-bottom: 1px solid #303030; +} + +.listview-mode-default .small +{ + font-size: 11px; } .listview-mode-default .small2 @@ -1923,6 +1982,85 @@ a.star-icon-right span line-height: 1.2; } +.listview-mode-default tbody a +{ + text-decoration: none; +} + +.listview-mode-default tbody a:hover +{ + text-decoration: underline; +} + +.listview-mode-default tbody.clickable tr +{ + cursor: pointer; +} + +.listview-mode-default tbody tr:hover +{ + background-color: #202020; +} + +.listview-mode-tiled td +{ + cursor: pointer; +} + +.listview-mode-tiled td:hover +{ + background-color: #202020; +} + +.listview-mode-tiled td.empty-cell +{ + cursor: default !important; +} + +.listview-mode-tiled td.empty-cell:hover +{ + background: none !important; +} + +.listview-mode-calendar th +{ + padding: 3px; + background-color: #404040; +} + +.listview-mode-calendar td +{ + vertical-align: top; +} + +.listview-mode-calendar .calendar-today +{ + background-color: #404040; + font-weight: bold; +} + +.listview-mode-calendar .calendar-date +{ + background-color: #242424; + padding: 3px; +} + +.listview-mode-calendar .calendar-event +{ + height: 88px; + padding: 3px; +} + +.listview tr.mergerow +{ + background-color: #131d1a; +} + +.listview tr.mergerow:hover +{ + background-color: #1a2924; +} + .listview tr.checked { background-color: #242424; @@ -1933,6 +2071,32 @@ a.star-icon-right span background-color: #2C2C2C; } +.listview tr.upgraded +{ + background-color: #242424; +} + +.listview tr.upgraded:hover +{ + background-color: #2C2C2C; +} + +.listview tr.upgraded td +{ + font-weight: bold; +} + +.listview-cb +{ + text-align: center; + cursor: default; +} + +.listview-cb input +{ + cursor: default; +} + .listview-nodata { padding: 4px; @@ -1946,16 +2110,36 @@ a.star-icon-right span background-color: black; } +.listview-indicators +{ + padding-left: 3px; +} + .sortasc { - background: url(../images/sort_asc.gif) no-repeat right center; padding-right: 15px !important; + background: url(../images/Listview/sort-asc.gif) no-repeat right center; } .sortdesc { - background: url(../images/sort_desc.gif) no-repeat right center; padding-right: 15px !important; + background: url(../images/Listview/sort-desc.gif) no-repeat right center; +} + +td.checked +{ + background-color: #202020; +} + +td.checked:hover +{ + background-color: #2C2C2C; +} + +td.checked .listview-cb:hover +{ + background-color: #343434; } .comment @@ -2972,7 +3156,12 @@ small, .listview-mode-default .small, .comment-edit-modes, .comment-edit-body font-size: 11px; } -a:hover, a.open, .text b, .text ol li div, .text li div, .infobox li div, .minibox h3 a, .comment-body b, .comment-body h3 +a.open, .text ol li div, .text li div, .infobox li div, .minibox h3 a, .comment-body b, .comment-body h3 +{ + color: #cccccc; +} + +a:hover, .text b { color: white; } @@ -3390,6 +3579,19 @@ div.modelviewer, div.screenshotviewer font-size: 13px; } +.notice-box { + padding: 8px; + color: #dddddd; + margin-bottom: 10px; + text-align: center; + background: #141414; + border: 1px solid #101010; + + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + div.announcement-pagetop div.announcement-inner { margin-top: 10px; } diff --git a/template/generic-no-filter.tpl b/template/generic-no-filter.tpl index b6ed16bd..2e083ae2 100644 --- a/template/generic-no-filter.tpl +++ b/template/generic-no-filter.tpl @@ -1,5 +1,4 @@ {include file='header.tpl'} -{assign var="file" value=$lvData.file}
    @@ -18,18 +17,38 @@ g_initPath({$page.path}); -
    -
    - +{if !empty($lvData.page.name) || !empty($lvData.page.h1Links)} +
    +{if !empty($lvData.page.h1Links)} + +{/if} +{if !empty($lvData.page.name)} +

    {$lvData.page.name}

    +{/if} +
    +{/if} +{if !empty($lvData.listviews)} + {if count($lvData.listviews) > 1} +
    + {/if} +
    +
    +{/if} +
    diff --git a/template/images/search2.gif b/template/images/Listview/quicksearch-cancel.gif similarity index 100% rename from template/images/search2.gif rename to template/images/Listview/quicksearch-cancel.gif diff --git a/template/images/search4.gif b/template/images/Listview/quicksearch.gif similarity index 100% rename from template/images/search4.gif rename to template/images/Listview/quicksearch.gif diff --git a/template/images/sort_asc.gif b/template/images/Listview/sort-asc.gif similarity index 100% rename from template/images/sort_asc.gif rename to template/images/Listview/sort-asc.gif diff --git a/template/images/sort_desc.gif b/template/images/Listview/sort-desc.gif similarity index 100% rename from template/images/sort_desc.gif rename to template/images/Listview/sort-desc.gif diff --git a/template/images/Listview/sort_asc.gif b/template/images/Listview/sort_asc.gif new file mode 100644 index 00000000..e7f769fb Binary files /dev/null and b/template/images/Listview/sort_asc.gif differ diff --git a/template/images/Listview/sort_desc.gif b/template/images/Listview/sort_desc.gif new file mode 100644 index 00000000..e3c0cf25 Binary files /dev/null and b/template/images/Listview/sort_desc.gif differ diff --git a/template/images/listview-withselected.gif b/template/images/Listview/withselected.gif similarity index 100% rename from template/images/listview-withselected.gif rename to template/images/Listview/withselected.gif diff --git a/template/itemset.tpl b/template/itemset.tpl index 31ec96c3..fc83950f 100644 --- a/template/itemset.tpl +++ b/template/itemset.tpl @@ -16,7 +16,7 @@ g_initPath({$page.path}); //]]> -{include file='bricks/infobox.tpl'} +{include file='bricks/infobox.tpl' info=$lvData.infobox}
    {$lang.links}{$lang.links} diff --git a/template/itemsets.tpl b/template/itemsets.tpl index 0eafc0a3..0c0c28e8 100644 --- a/template/itemsets.tpl +++ b/template/itemsets.tpl @@ -95,7 +95,7 @@ {if isset($filter.setCr)}{$filter.setCr}{/if} //]]> -
    +
    diff --git a/template/js/Draggable.js b/template/js/Draggable.js index b4175b56..bc8dd763 100644 --- a/template/js/Draggable.js +++ b/template/js/Draggable.js @@ -102,8 +102,8 @@ var Draggable = new function () { dragObj = obj; } - Tooltip.disabled = true; - Tooltip.hide(); + $WH.Tooltip.disabled = true; + $WH.Tooltip.hide(); if (obj.onDrag) { obj.onDrag(e, dragObj, obj); @@ -154,7 +154,7 @@ var Draggable = new function () { $WH.dE(document, 'mousemove', onMouseMove); $WH.dE(document, 'mouseup', onMouseUp); - Tooltip.disabled = false; + $WH.Tooltip.disabled = false; dragObj.className = dragObj.className.replace(/dragged/, ''); dragObj = null; diff --git a/template/js/Mapper.js b/template/js/Mapper.js index 9d12ce88..7090d103 100644 --- a/template/js/Mapper.js +++ b/template/js/Mapper.js @@ -849,10 +849,10 @@ Mapper.prototype = { Menu.add(_.a, _.a.menu, { showAtCursor: true }); // _.a.onclick = function() { // (Menu.show.bind(this))(); - // Tooltip.hide(); + // $WH.Tooltip.hide(); // this.onmouseout = function() { // Menu.hide(); - // this.onmouseout = Tooltip.hide(); + // this.onmouseout = $WH.Tooltip.hide(); // }.bind(this); // $WH.sp(); // return false; @@ -1023,7 +1023,7 @@ Mapper.prototype = { _.a = a; _.floor = floor; a.onmouseover = this.pinOver; - a.onmouseout = Tooltip.hide; + a.onmouseout = $WH.Tooltip.hide; a.onclick = $WH.sp; this.pins.push(_); @@ -1077,7 +1077,7 @@ Mapper.prototype = { pinOver: function() { - Tooltip.show(this, this.tt, 4, 0); + $WH.Tooltip.show(this, this.tt, 4, 0); }, getMousePos: function(e) diff --git a/template/js/Markup.js b/template/js/Markup.js index 4c8f7efb..cef27bbe 100644 --- a/template/js/Markup.js +++ b/template/js/Markup.js @@ -1,696 +1,4238 @@ +// stupid little workaround so modes can be set without magic numbers in tag definitions +// now made moot by being unable to use variables as a key +var MARKUP_MODE_COMMENT = 1, + MARKUP_MODE_ARTICLE = 2, + MARKUP_MODE_QUICKFACTS = 3, + MARKUP_MODE_SIGNATURE = 4, + MARKUP_MODE_REPLY = 5, + MARKUP_CLASS_ADMIN = 40, + MARKUP_CLASS_STAFF = 30, + MARKUP_CLASS_PREMIUM = 20, + MARKUP_CLASS_USER = 10, + MARKUP_CLASS_PENDING = 1; + +var MARKUP_SOURCE_LIVE = 1, + MARKUP_SOURCE_PTR = 2, + MARKUP_SOURCE_BETA = 3; + +var MarkupModeMap = {}; +MarkupModeMap[MARKUP_MODE_COMMENT] = 'comment'; +MarkupModeMap[MARKUP_MODE_REPLY] = 'reply'; +MarkupModeMap[MARKUP_MODE_ARTICLE] = 'article'; +MarkupModeMap[MARKUP_MODE_QUICKFACTS] = 'quickfacts'; +MarkupModeMap[MARKUP_MODE_SIGNATURE] = 'signature'; + +var MarkupSourceMap = {}; +MarkupSourceMap[MARKUP_SOURCE_LIVE] = 'live'; +MarkupSourceMap[MARKUP_SOURCE_PTR] = 'ptr'; +MarkupSourceMap[MARKUP_SOURCE_BETA] = 'beta'; + var Markup = { - MODE_COMMENT: 1, - MODE_ARTICLE: 2, - MODE_QUICKFACTS: 3, - MODE_SIGNATURE: 4, - simpleTags: { - img: 1, - pad: 1, - item: 1, - spell: 1, - achievement: 1, - money: 1, - npc: 1, - skill: 1, - pet: 1, - 'class': 1, - race : 1 + MODE_COMMENT: MARKUP_MODE_COMMENT, + MODE_REPLY: MARKUP_MODE_REPLY, + MODE_ARTICLE: MARKUP_MODE_ARTICLE, + MODE_QUICKFACTS: MARKUP_MODE_QUICKFACTS, + MODE_SIGNATURE: MARKUP_MODE_SIGNATURE, + + SOURCE_LIVE: MARKUP_SOURCE_LIVE, + SOURCE_PTR: MARKUP_SOURCE_PTR, + SOURCE_BETA: MARKUP_SOURCE_BETA, + + CLASS_ADMIN: MARKUP_CLASS_ADMIN, + CLASS_STAFF: MARKUP_CLASS_STAFF, + CLASS_PREMIUM: MARKUP_CLASS_PREMIUM, + CLASS_USER: MARKUP_CLASS_USER, + CLASS_PENDING: MARKUP_CLASS_PENDING, + + whitelistedWebsites: [/(.*\.)?wowhead.com/i, /(.*\.)?thottbot.com/i, /(.*\.)?torhead.com/i, /(.*\.)?mmoui.com/i, /(.*\.)?tankspot.com/i, /(.*\.)?guildfans.com/i, /(.*\.)?allakhazam.com/i, /(.*\.)?zam.com/i, /(.*\.)?blizzard.com/i, /(.*\.)?worldofwarcraft.com/i, /(.*\.)?wow-europe.com/i, /(.*\.)?battle.net/i, /(.*\.)?sc2ranks.com/i, /(.*\.)?torchlightarmory.com/i, /(.*\.)?vindictusdb.com/i, /(.*\.)?wowinterface.com/i, /(.*\.)?vginterface.com/i, /(.*\.)?lotrointerface.com/i, /(.*\.)?eq2interface.com/i, /(.*\.)?eqinterface.com/i, /(.*\.)?mmo-champion.com/i, /(.*\.)?joystiq.com/i, /(.*\.)?wow-heroes.com/i, /(.*\.)?be-imba.hu/i, /(.*\.)?wowpedia.org/i, /(.*\.)?curse.com/i, /(.*\.)?elitistjerks.com/i, /(.*\.)?wowwiki.com/i, /(.*\.)?worldoflogs.com/i, /(.*\.)?wowinsider.com/i, /(.*\.)?guildwork.com/i], + + rolesToClass: function(roles) + { + if(roles & (U_GROUP_ADMIN|U_GROUP_VIP|U_GROUP_DEV)) + return Markup.CLASS_ADMIN; + else if(roles & U_GROUP_STAFF) + return Markup.CLASS_STAFF; + else if(roles & U_GROUP_PREMIUM) + return Markup.CLASS_PREMIUM; + else if(roles & U_GROUP_PENDING) + return Markup.CLASS_PENDING; + else + return Markup.CLASS_USER; }, - _prepare: function(D, C) { - Markup.tags = []; - Markup.links = []; - Markup.nTags = 0; - Markup.nLinks = 0; - D = D.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); - D = D.replace(/^(\s*)|\r|(\s*)$/g, ""); - D = D.replace(/\n(\s+)\n/g, "\n\n"); - var B = "b|i|u|s|small"; - var A = "b|i|u|s|small|url"; - switch (C) { - case Markup.MODE_ARTICLE: - Markup.maps = []; - D = D.replace(/(.)?\[toggler\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["id", "[a-z0-9]+"]]); - Markup.tags.push({ - name: "toggler", - close: false, - other: G - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[div\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["id", "[a-z0-9]+"], ["hidden", ""]]); - Markup.tags.push({ - name: "div", - close: false, - other: G - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[img\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["src", "\\S+"], ["width", "[0-9]+"], ["height", "[0-9]+"], ["float", "left|right"]]); - Markup.tags.push({ - name: "img", - close: false, - other: G - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[map\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["zone", "[0-9]+[a-z]?"], ["source", "\\S+"]]); - Markup.tags.push({ - name: "map", - close: false, - other: G - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[pin\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["x", "[0-9]{1,2}(\\.[0-9])?"], ["y", "[0-9]{1,2}(\\.[0-9])?"], ["url", "\\S+"], ["type", "[0-9]+"]]); - Markup.tags.push({ - name: "pin", - close: false, - other: G - }); - return (E || "") + "" - } - }); - B += "|h3|minibox"; - A += "|h3|minibox|toggler|div|map|pin"; - case Markup.MODE_QUICKFACTS: - D = D.replace(/(.)?\[color\s*[\s+=:]\s*(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|c[0-9]{2}|r[1-4]?|q[0-8]?|#[a-f0-9]{6})\]/gi, - function(F, E, G) { - if (E == "\\") { - return F.substr(1) - } else { - Markup.tags.push({ - name: "color", - color: false, - other: (G).toLowerCase() - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[(item|spell|achievement|class|race|npc|skill|pet|money)\s*[\s+=:]\s*(\d+?)\]/gi, - function(F, E, I, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup.tags.push({ - name: (I).toLowerCase(), - close: false, - other: H - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[icon\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["name", "\\S+"], ["size", "tiny|small|medium|large"], ["float", "left|right"]]); - Markup.tags.push({ - name: "icon", - close: false, - other: G - }); - return (E || "") + "" - } - }); - D = D.replace(/(.)?\[span\s*[\s+=:]\s*(.+?)\]/gi, - function(F, E, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup._yank(H, [["class", "\\S+"]]); - Markup.tags.push({ - name: "span", - close: false, - other: G - }); - return (E || "") + "" - } - }); - B += "|pad|span"; - A += "|color|span|icon"; - case Markup.MODE_COMMENT: - D = D.replace(/(.)?\[quote(\s*[\s+=:]\s*([^\]]+?))?\]/gi, - function(F, E, I, H) { - if (E == "\\") { - return F.substr(1) - } else { - var G = Markup.tags.push({ - name: "quote", - close: false, - other: H - }); - return (E || "") + "" - } - }); - B += "|code|ul|ol|li"; - A += "|code|quote|ul|ol|li"; - default: - D = D.replace(/(.)?\[url\s*[\s+=:]\s*([^\]]+?)\]/gi, - function(F, E, G) { - if (E == "\\") { - return F.substr(1) - } else { - Markup.tags.push({ - name: "url", - close: false, - other: G - }); - return (E || "") + "" - } - }) + + defaultSource: false, + nameCol: 'name_enus', + domainToLocale: { + 'www': 'enus', + 'ptr': 'ptr', + 'beta': 'beta', + 'mop': 'beta', + 'fr': 'frfr', + 'de': 'dede', + 'es': 'eses', + 'ru': 'ruru', + 'pt': 'ptbr' + }, + maps: [], + firstTags: {}, + postTags: [], + collectTags: {}, + excludeTags: {}, + tooltipTags: {}, + tooltipBare: {}, + attributes: { + id: { req: false, valid: /^[a-z0-9_-]+$/i }, + title: { req: false, valid: /[\S ]+/ }, + 'class': { req: false, valid: /\S+/ } + }, + IsLinkAllowed: function(link) + { + var matches = link.match('[a-z]+:\/\/([a-z0-9\.\-]+)'); + + if(!matches) + return true; + + var domain = matches[1]; + var allowed = false; + + for(var i in Markup.whitelistedWebsites) + { + var r = Markup.whitelistedWebsites[i]; + + if(domain.search(r) == 0) + allowed = true; } - D = D.replace(new RegExp("(.)?\\[(" + B + ")\\]", "gi"), - function(F, E, G) { - if (E == "\\") { - return F.substr(1) - } else { - Markup.tags.push({ - name: (G).toLowerCase(), - close: false, - other: "" - }); - return (E || "") + "" - } - }); - D = D.replace(new RegExp("(.)?\\[/(" + A + ")\\]", "gi"), - function(F, E, G) { - if (E == "\\") { - return F.substr(1) - } else { - Markup.tags.push({ - name: (G).toLowerCase(), - close: true, - other: "" - }); - return (E || "") + "" - } - }); - D = D.replace(/(https?:\/\/|www\.)([\/_a-z0-9\%\?#@\-\+~&=;:'\(\)]|\.\S|,\S)+/gi, - function(E) { - Markup.links.push(E); - return "" - }); - return D + + return allowed; }, - _parseCode: function(G, K, E) { - var B = [], - I = [], - D = "", - C; - var F = G.length; - while (E < F) { - if (G.charAt(E) == "<" && G.charAt(E + 1) == "t") { - if (D.length) { - if (K == "ol" || K == "ul") { - if ($WH.trim(D).length) { - I.push(["", D]) - } - } else { - if (K != "map") { - B.push(["", D]) - } + tags: { + '': + { + empty: true, + noHelp: true, + allowInReplies: true, + toHtml: function(attr, extra) + { + extra = extra || $.noop; + + if(attr._text == ' ' && !extra.noNbsp) + attr._text = ' '; + + attr._text = attr._text.replace(/\\\[/g, '['); + + if(extra && extra.noLink) + return attr._text; + else if(extra && extra.needsRaw) + return attr._rawText; + else + { + var link = []; + var text = Markup._preText(attr._rawText.replace(/(https?:\/\/|www\.)([\/_a-z0-9\%\?#@\-\+~&=;:']|\.[a-z0-9\-])+/gi, function(match) { + matchUrl = Markup._preText(match.replace(/^www/, 'http://www')); + match = Markup._preText(match); + var i = link.length; + link.push([matchUrl, match]); + return '$L' + i; + })); + text = text.replace(/\$L([\d+]) /gi, '$L$1 '); + for(var i in link) + { + text = text.replace('$L' + i, function(match) { + if(Markup.allow < Markup.CLASS_USER && !Markup.IsLinkAllowed(link[i][0])) + return $WH.sprintf('[$1]', LANG.linkremoved); + var url = ''; + return url; + }); } - D = "" + return text; } - E += 2; - C = ""; - while (G.charAt(E) != ">") { - C += G.charAt(E); ++E - }++E; - var L = Markup.tags[parseInt(C)]; - if (L.close) { - if (L.name == K) { - break + }, + toText: function(attr) + { + return attr._text; + } + }, + achievement: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + diff: { req: false, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + var rel = []; + + if(attr.diff) + rel.push('diff=' + attr.diff); + + if(g_achievements[id] && g_achievements[id][nameCol]) + { + var ach = g_achievements[id]; + return ' ' + Markup._safeHtml(ach[nameCol]) + ''; + } + return '(' + LANG.types[10][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_achievements[id] && g_achievements[id][nameCol]) + return Markup._safeHtml(g_achievements[id][nameCol]); + return LANG.types[10][0] + ' #' + id; + } + }, + achievementpoints: + { + empty: true, + attr: + { + unnamed: {req: true, valid: /^[0-9]+$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = '' + attr.unnamed + ''; + return str; + } + }, + anchor: + { + empty: true, + ltrim: true, + rtrim: true, + attr: + { + unnamed: { req: false, valid: /\S+/ } + }, + validate: function(attr) + { + if(!attr.unnamed && !attr.id) + return false; + return true; + }, + toHtml: function(attr) + { + if(!attr.unnamed && attr.id) + { + attr.unnamed = attr.id; + attr.id = null; + } + return ''; + } + }, + acronym: + { + empty: false, + attr: + { + unnamed: { req: false } + }, + toHtml: function(attr) + { + return ['', '']; + } + }, + b: + { + empty: false, + allowInReplies: true, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/<(b|big|strong)\b[\s\S]*?>([\s\S]*?)<\/\1>/gi, '[b]$2[/b]'); + } + }, + blip: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /\S+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var url = 'http://blip.tv/play/' + attr.unnamed; + var width = 600; + var height = 368; + + var html = ''; + // object tag causing issues in chrome? + /*html += ''; + html += ''; + html += ''; + html += '';*/ + html += ''; + //html += ''; + + return html; + } + }, + br: + { + empty: true, + toHtml: function(attr) + { + return '
    '; + }, + fromHtml: function(str) + { + return str.replace(//gi, "\n"); + } + }, + 'class': + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/i }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + if(attr.unnamed >= 1 && attr.unnamed <= 11) + return true; + return false; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_classes[id] && g_classes[id][nameCol]) + { + var cls = g_classes[id]; + return ' ' + Markup._safeHtml(cls[nameCol]) + ''; + } + return '(' + LANG.types[13][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_classes[id] && g_classes[id][nameCol]) + return Markup._safeHtml(g_classes[id][nameCol]); + return LANG.types[13][0] + ' #' + id; + } + }, + code: + { + block: true, + empty: false, + rtrim: true, + itrim: true, + helpText: true, + allowedChildren: { '': 1 }, + toHtml: function(attr) + { + var open = '
    ';
    +				return [open, '
    ']; + } + }, + color: + { + empty: false, + attr: + { + unnamed: { req: true, valid: /^.*/i } + }, + allowedClass: MARKUP_CLASS_STAFF, + /* Syntax: name: class */ + extraColors: {deathknight: 'c6', dk: 'c6', druid: 'c11', hunter: 'c3', mage: 'c8', paladin: 'c2', priest: 'c5', rogue: 'c4', shaman: 'c7', warlock: 'c9', warrior: 'c1', poor: 'q0', common: 'q1', uncommon: 'q2', rare: 'q3', epic: 'q4', legendary: 'q5', artifact: 'q6', heirloom: 'q7'}, + toHtml: function(attr) + { + var valid = /^(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|c\d+|r\d+|q\d*?|#[a-f0-9]{6})$/i; + var str = '']; + } + }, + currency: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + amount: { req: false, valid: /^[0-9\:]+$/ }, + icon: { req: false, valid: /^false$/i }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_gatheredcurrencies[id] && g_gatheredcurrencies[id][nameCol]) + { + var curr = g_gatheredcurrencies[id]; + if(attr.amount) + return ' ' + attr.amount.split(':').join(' - ') + ''; + else + return ' ' + Markup._safeHtml(curr[nameCol]) + ''; + } + + return '(' + LANG.types[17][0] + ' #' + id + ')' + (attr.amount > 0 ? ' x' + attr.amount : ''); + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_gatheredcurrencies[id] && g_gatheredcurrencies[id][nameCol]) + return Markup._safeHtml(g_gatheredcurrencies[id][nameCol]); + return LANG.types[17][0] + ' #' + id; + } + }, + db: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /^(live|ptr|beta|mop)$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + if(attr.unnamed == 'live') + Markup.defaultSource = Markup.SOURCE_LIVE; + else if(attr.unnamed == 'ptr') + Markup.defaultSource = Markup.SOURCE_PTR; + else if(attr.unnamed == 'beta' || attr.unnamed == 'mop') + Markup.defaultSource = Markup.SOURCE_BETA; + return ''; + }, + toText: function(attr) + { + if(attr.unnamed == 'live') + Markup.defaultSource = Markup.SOURCE_LIVE; + else if(attr.unnamed == 'ptr') + Markup.defaultSource = Markup.SOURCE_PTR; + else if(attr.unnamed == 'beta' || attr.unnamed == 'mop') + Markup.defaultSource = Markup.SOURCE_BETA; + return ''; + } + }, + del: + { + empty: false, + attr: + { + copy: { req: false, valid: /^true$/ } + }, + toHtml: function(attr) + { + var str = '']; + } + }, + div: + { + empty: false, + block: true, + ltrim: true, + rtrim: true, + itrim: true, + attr: + { + clear: { req: false, valid: /^(left|right|both)$/i }, + 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+$/ }, + width: { req: false, valid: /^[0-9]+(px|em|\%)$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = ' 0) + str += ' style="' + styles.join(';') + '"'; + if(classes.length > 0) + str += ' class="' + classes.join(' ') + '"'; + + str += '>'; + return [str, '
    ']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + var align = m[i][1].match(/float:\s*(left|right)"/i), + width = m[i][1].match(/width[:="]+\s*([0-9]+)/i); + + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n" + Array(depth + 1).join("\t") + '[div' + (align ? ' float=' + align[1] : '') + (width ? ' width=' + width[1] : '') + ']' + Markup.tags.div.fromHtml(m[i][0], depth + 1) + '[/div]'); + } + } + + return str; + } + }, + event: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_holidays[id] && g_holidays[id][nameCol]) + { + var evt = g_holidays[id]; + return '' + Markup._safeHtml(evt[nameCol]) + ''; + } + return '(' + LANG.types[12][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_holidays[id] && g_holidays[id][nameCol]) + return Markup._safeHtml(g_holidays[id][nameCol]); + return LANG.types[12][0] + ' #' + id; + } + }, + faction: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_factions[id] && g_factions[id][nameCol]) + { + var fac = g_factions[id]; + return '' + Markup._safeHtml(fac[nameCol]) + ''; + } + return '(' + LANG.types[8][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_factions[id] && g_factions[id][nameCol]) + return Markup._safeHtml(g_factions[id][nameCol]); + return LANG.types[8][0] + ' #' + id; + } + }, + feedback: + { + empty: true, + allowedClass: MARKUP_CLASS_STAFF, + attr: + { + mailto: { req: false, valid: /^true$/i } + }, + toHtml: function(attr) + { + return 'feedback@wowhead.com'; + } + }, + forumrules: + { + empty: true, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + return 'forum rules'; + } + }, + hr: + { + empty: true, + trim: true, + allowedModes: { article: 1, quickfacts: 1, comment: 1 }, + toHtml: function(attr) + { + return '
    '; + }, + fromHtml: function(str) + { + return str.replace(//gi, '[hr]'); + } + }, + h2: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedClass: MARKUP_CLASS_STAFF, + attr: + { + unnamed: { req: false, valid: /^first$/i }, + clear: { req: false, valid: /^(true|both|left|right)$/i }, + toc: { req: false, valid: /^false$/i } + }, + toHtml: function(attr) + { + if(!attr.id) + attr.id = g_urlize(attr._textContents); + str = ' 0) + str += ' class="' + classes.join(' ') + '"'; + if(attr.clear) + { + if(attr.clear == 'true' || attr.clear == 'both') + str += ' style="clear: both"'; + else + str += ' style="clear: ' + attr.clear + '"'; + } + return [str + '>', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/h2>/gi, "\n[h2]$1[/h2]"); + } + }, + h3: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + attr: + { + unnamed: { req: false, valid: /^first$/i }, + toc: { req: false, valid: /^false$/i } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + if(!attr.id) + attr.id = g_urlize(attr._textContents); + var str = ' 0) + str += ' class="' + classes.join(' ') + '"'; + return [str + '>', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/h3>/gi, "\n[h3]$1[/h3]"); + } + }, + html: + { + empty: false, + allowedClass: MARKUP_CLASS_ADMIN, + allowedChildren: { '': 1 }, + rawText: true, + taglessSkip: true, + toHtml: function(attr) + { + return [attr._contents]; + } + }, + i: + { + empty: false, + allowInReplies: true, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/<(i|em)\b[\s\S]*?>([\s\S]*?)<\/\1>/gi, '[i]$1[/i]'); + } + }, + icon: + { + empty: false, + itrim: true, + attr: + { + align: { req: false, valid: /^right$/i }, + 'float': { req: false, valid: /^(left|right)$/i }, + name: { req: false, valid: /\S+/ }, + size: { req: false, valid: /^(tiny|small|medium|large)$/ }, + unnamed: { req: false, valid: /^class$/i }, + url: { req: false, valid: /\S+/ }, + preset: { req: false, valid: /\S+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + presets: { + boss: g_staticUrl + '/images/icons/boss.gif', + heroic: g_staticUrl + '/images/icons/heroic.gif' + }, + validate: function(attr) + { + if(!attr.name && !attr.url && !attr.preset) + return false; + if(attr.preset && !Markup.tags.icon.presets[attr.preset]) + return false; + return true; + }, + toHtml: function(attr) + { + var size = (attr.size ? attr.size : "tiny"); + if(!attr.name) attr.name = ''; + + if(size == "tiny") { + var str = ''; + } + else + str += attr.name + '">'; + return [str, '']; + } + else + { + var str = '' : '">' ); + + var sizes = {'small': 0, 'medium': 1, 'large': 2}; + var url = null; + if(attr.url && Markup._isUrlSafe(attr.url)) + url = attr.url; + else if(attr._textContents && Markup._isUrlSafe(attr._textContents)) + url = attr._textContents; + + icon = Icon.create(attr.name.toLowerCase(), sizes[size], null, url); + + str += icon.innerHTML + ''; + return [str]; + } + } + }, + iconlist: + { + empty: false, + block: true, + ltrim: true, + rtrim: true, + attr: + { + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + taglessSkip: true, + allowedClass: MARKUP_CLASS_STAFF, + allowedChildren: { b: 1, achievement: 1, currency: 1, faction: 1, holiday: 1, item: 1, itemset: 1, npc: 1, object: 1, pet: 1, quest: 1, spell: 1, title: 1, zone: 1 }, + toHtml: function(attr) + { + var domain = Markup._getDatabaseDomainInfo(attr)[2]; + + var str = '', m; + for(var i = 0; i < attr._nodes.length; ++i) + { + var node = $WH.dO(attr._nodes[i]); + node.attr.domain = domain; + + var html = Markup.tags[node.name].toHtml(node.attr), + type = node.name, + href = '', + icon = ''; + + if(typeof html != 'string') // Bold open/close tags + html = html[0] + node.attr._contents + html[1]; + else if(typeof html == 'string' && (m = html.match(/href="(.+?)".+?url\(\/images\/wow\/icons\/tiny\/(.+?)\.gif\)/))) + { + node.attr.icon = 'false'; + html = Markup.tags[node.name].toHtml(node.attr); + href = m[1]; + icon = m[2]; + } + + if(html) + str += '
    '; + } + + if(str) + str = '
    {$lang.quickFacts}
    ' + (icon ? Markup.toHtml('[icon name=' + icon + ' size=small url=' + href + ']', { skipReset: true }) : '
    •  
    ') + '
    ' + html + '
    ' + str + '
    '; + + return [str]; + } + }, + img: + { + empty: true, + attr: + { + src: { req: false, valid: /\S+/ }, + icon: { req: false, valid: /\S+/ }, + id: { req: false, valid: /^[0-9]+$/ }, + blog: { req: false, valid: /^[0-9]+$/ }, + size: { req: false, valid: /^(thumb|resized|normal|large|medium|small|tiny)$/i }, + width: { req: false, valid: /^[0-9]+$/ }, + height: { req: false, valid: /^[0-9]+$/ }, + 'float': { req: false, valid: /^(left|right|center)$/i }, + border: { req: false, valid: /^[0-9]+$/ }, + margin: { req: false, valid: /^[0-9]+$/ } + }, + blogSize: /^(thumb|normal)$/i, + idSize: /^(thumb|resized|normal)$/i, + iconSize: /^(large|medium|small|tiny)$/i, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if(attr.src) + return true; + else if(attr.id) + return (attr.size ? Markup.tags.img.idSize.test(attr.size) : true); + else if(attr.icon) + return (attr.size ? Markup.tags.img.iconSize.test(attr.size) : true); + else if(attr.blog) + return (attr.size ? Markup.tags.img.blogSize.test(attr.size) : true); + return false; + }, + toHtml: function(attr) + { + var str = '' + str; + post = ''; + var screenshot = { + url: url, + caption: img.alt, + width: img.width, + height: img.height, + noMarkup: true + }; + g_screenshots[Markup.uid].push(screenshot); } - if (K == "ol" || K == "ul") { - if (L.name == "li") { - I = Markup._cleanNodes(I); - if (I.length) { - B.push(["li", I]); - I = [] - } - B.push(["li", J]) - } else { - I.push([L.name, J, L.other]) + else + str += ' src="' + g_staticUrl + '/uploads/blog/images/' + attr.blog + (img.type == 3 ? '.png' : '.jpg') + '" alt="' + Markup._safeHtml(img.alt) + '" width="' + img.width + '" height="' + img.height + '"'; + } + else + return ('Image #' + attr.blog); + } + + if(attr.width) + str += ' width="' + attr.width + '"'; + if(attr.height) + str += ' height="' + attr.height + '"'; + if(attr['float']) + { + if(attr['float'] == 'center') + { + str = '
    ' + str + ' style="margin: 10px auto"'; + post = '
    '; + } + else + { + str += ' style="float: ' + attr['float'] + ';'; + if(!attr.margin) + attr.margin = 10; + if(attr['float'] == 'left') + str += ' margin: 0 ' + attr.margin + 'px ' + attr.margin + 'px 0"'; + else + str += ' margin: 0 0 ' + attr.margin + 'px ' + attr.margin + 'px"'; + } + } + if(attr.border != 0) + str += ' class="border"'; + if(attr.title) + str += ' alt="' + attr.title + '"'; + else + str += ' alt=""'; + str += ' />' + post; + return str; + }, + fromHtml: function(str) + { + var m; + if(m = str.match(//gi)) + { + for(var i = 0; i < m.length; ++i) + { + var source = m[i].match(/src="([\s\S]+?)"/i), + width = m[i].match(/width[:="]+\s*([0-9]+)/i), + height = m[i].match(/height[:="]+\s*([0-9]+)/i), + border = m[i].match(/border[:="]+\s*([0-9]+)/i); + + str = str.replace(m[i], '[img src=' + source[1] + (width ? ' width=' + width[1] : '') + (height ? ' height=' + height[1] : '') + ' border=' + (border ? border[1] : 0) + ']'); + } + } + return str; + } + }, + ins: + { + empty: false, + toHtml: function(attr) + { + return ['', '']; + } + }, + item: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/i }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_items[id] && g_items[id][nameCol]) + { + var item = g_items[id]; + var str = ' '; + str += Markup._safeHtml(item[nameCol]) + ''; + return str; + } + return '(' + LANG.types[3][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_items[id] && g_items[id][nameCol]) + return Markup._safeHtml(g_items[id][nameCol]); + return LANG.types[3][0] + ' #' + id; + } + }, + itemset: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^-?[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_itemsets[id] && g_itemsets[id][nameCol]) + { + var set = g_itemsets[id]; + return '' + Markup._safeHtml(set[nameCol]) + ''; + } + return '(' + LANG.types[4][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_itemsets[id] && g_itemsets[id][nameCol]) + return Markup._safeHtml(g_itemsets[id][nameCol]); + return LANG.types[4][0] + ' #' + id; + } + }, + li: + { + empty: false, + itrim: true, + allowedParents: { ul: 1, ol: 1 }, + helpText: function() + { + var str = ''; + str += '[ul]'; + for(var i = 0; i < 3; ++i) + str += '\n[li]' + LANG.markup_li + '[/li]'; + str += '\n[/ul]\n\n'; + str += '[ol]'; + for(var i = 0; i < 3; ++i) + str += '\n[li]' + LANG.markup_li + '[/li]'; + str += '\n[/ol]\n'; + return str.toLowerCase(); + }, + toHtml: function(attr) + { + return ['
    ', '
    ']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n\t" + Array(depth + 1).join("\t") + '[li]' + Markup.tags.li.fromHtml(m[i][0], depth + 1) + '[/li]'); + } + + return str; + } + }, + lightbox: + { + empty: false, + allowedClass: MARKUP_CLASS_STAFF, + attr: + { + unnamed: { req: true, valid: /^(map|model|screenshot)$/ }, + zone: { req: false, valid: /^-?[0-9]+[a-z]?$/i }, + floor: { req: false, valid: /^[0-9]+$/ }, + pins: { req: false, valid: /^[0-9]+$/ } + }, + validate: function(attr) + { + switch(attr.unnamed) + { + case 'map': + if(attr.zone) + return true; + break; + case 'model': + break; + case 'screenshot': + break; + } + return false; + }, + toHtml: function(attr) + { + var url = ''; + var onclick = ''; + switch(attr.unnamed) + { + case 'map': + url = '/maps=' + attr.zone; + if(attr.floor) + url += '.' + attr.floor; + if(attr.pins) + url += ':' + attr.pins; + var link = url.substr(6); + + onclick = 'if(!g_isLeftClick(event)) return; MapViewer.show({ link: \'' + link + '\' }); return false;'; + break; + } + + if(url && onclick) + return ['', '']; + return ''; + } + }, + map: + { + empty: false, + attr: + { + zone: { req: true, valid: /^-?[0-9a-z\-_]+$/i }, + source: { req: false, valid: /\S+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + allowedChildren: { pin: 1 }, + toHtml: function(attr) + { + var coords = attr._contents; + attr.id = 'dsgdfngjkfdg' + (Markup.maps.length); + var str = '
    '; + + Markup.maps.push([attr.id, attr.zone, coords]); + + return [ str ]; + } + }, + n5: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /^[0-9\.]+$/ } + }, + toHtml: function(attr) + { + return GetN5(attr.unnamed); + } + }, + pin: + { + empty: false, + attr: + { + url: { req: false, valid: /\S+/ }, + type: { req: false, valid: /^[0-9]+$/ }, + x: { req: true, valid: /^[0-9]{1,2}(\.[0-9])?$/ }, + y: { req: true, valid: /^[0-9]{1,2}(\.[0-9])?$/ }, + path: { req: false, valid: /^([0-9]{1,2}(\.[0-9])?[,:]?)+$/ } + }, + taglessSkip: true, + allowedClass: MARKUP_CLASS_STAFF, + allowedParents: { map: 1 }, + toHtml: function(attr) + { + if(attr.url && !Markup._isUrlSafe(attr.url)) + attr.url = ''; + var label = attr._contents; + if(attr.url && attr.url.indexOf('npc=') != -1) + label = '' + label + '
    Click to view this NPC'; + + var lines = null; + if(attr.path) + { + var coords = attr.path.split(':'), lines = []; + for(var i = 0, len = coords.length; i < len; ++i) + { + var parts = coords[i].split(','); + if(parts.length == 2) + lines.push([parseFloat(parts[0] || 0), parseFloat(parts[1] || 0)]); + } + } + + return [ [parseFloat(attr.x || 0), parseFloat(attr.y || 0), { label: label, url: attr.url, type: attr.type, lines: lines }] ]; + /*var str = '[' + parseFloat(attr.x || 0) + ',' + parseFloat(attr.y || 0) + ',{label: \'' + Markup._safeJsString(label) + '\''; + if(attr.url) + str += ', url: \'' + Markup._safeJsString(Markup._fixUrl(attr.url)) + '\''; + if(attr.type) + str += ', type: \'' + Markup._safeJsString(attr.type) + '\''; + str += '}]'; + return [ [str] ];*/ + } + }, + markupdoc: + { + empty: true, + attr: + { + tag: { req: false, valid: /[a-z0-9]+/i }, + help: { req: false, valid: /^(admin|staff|premium|user|pending)$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if(attr.tag && !Markup.tags[attr.tag]) + return false; + return true; + }, + toHtml: function(attr) + { + var str = '', + helpClass = (attr.help ? Markup['CLASS_' + attr.help.toUpperCase()] : false); + + if(helpClass) + str += LANG.markup_helpdoc + '
    '; + + if(attr.tag) + str = Markup._generateTagDocs(attr.tag, helpClass); + else + { + for(var tag in Markup.tags) + { + if(!helpClass && str != '') + str += '
    '; + str += Markup._generateTagDocs(tag, helpClass); + } + } + + return str + (helpClass ? '
    ' + LANG.markup_help1 + '' + LANG.markup_help2 + '
    ' : ''); + } + }, + menu: + { + empty: true, + trim: true, + ltrim: true, + rtrim: true, + attr: + { + tab: { req: true, valid: /^[0-9]+$/ }, + path: { req: true, valid: /\S+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var path = attr.path.split(','); + PageTemplate.set({activeTab: attr.tab, breadcrumb: path}); + } + }, + minibox: + { + empty: false, + rtrim: true, + itrim: true, + attr: + { + 'float': { req: false, valid: /^(left|right)$/i } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = ''; + return [str, '']; + } + }, + model: + { + empty: false, + attr: + { + item: { req: false, valid: /^[0-9]+$/ }, + object: { req: false, valid: /^[0-9]+$/ }, + npc: { req: false, valid: /^[0-9]+$/ }, + itemset: { req: false, valid: /^[0-9,]+$/ }, + slot: { req: false, valid: /^[0-9]+$/ }, + humanoid: { req: false, valid: /^1$/ }, + 'float': { req: false, valid: /^(left|right)$/i }, + img: { req: false, valid: /\S+/ }, + link: { req: false, valid: /\S+/ }, + label: { req: false, valid: /[\S ]+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + skipSlots: { 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 16: 1, 19: 1, 20: 1 }, + toHtml: function(attr) + { + var str = ''; + if(attr.npc) + { + str = '' + Markup._safeHtml(attr._contents) + '' + Markup._safeHtml(attr._contents) + '' + Markup._safeHtml(attr._contents) + ''; + } + else + return ['[model]', '[/model]']; + return [str, '']; + } + }, + money: + { + empty: true, + attr: + { + unnamed: { req: false, valid: /^[0-9]+$/ }, + side: { req: false, valid: /^(alliance|horde|both)$/i }, + items: { req: false, valid: /^[0-9,]+$/ }, + currency: { req: false, valid: /^[0-9,]+$/ }, + achievement: { req: false, valid: /\S+/ }, + // DEPRECATED + arena: { req: false, valid: /^[0-9]+$/ }, + honor: { req: false, valid: /^[0-9]+$/ }, + conquest: { req: false, valid: /^[0-9]+$/ }, + justice: { req: false, valid: /^[0-9]+$/ }, + valor: { req: false, valid: /^[0-9]+$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var items = [], + currency = []; + + if(attr.items) + { + var split = attr.items.split(','); + if(split.length >= 2) + for(var i = 0; i < split.length-1; i += 2) + items.push([split[i], split[i+1]]); + } + + if(attr.currency) + { + var split = attr.currency.split(','); + if(split.length >= 2) + for(var i = 0; i < split.length-1; i += 2) + currency.push([split[i], split[i+1]]); + } + + // Backwards compatability + if(attr.arena && !attr.conquest) + attr.conquest = attr.arena; + if(attr.honor) + currency.push([392, attr.honor]); + if(attr.conquest) + currency.push([390, attr.conquest]); + if(attr.justice) + currency.push([395, attr.justice]); + if(attr.valor) + currency.push([396, attr.valor]); + + return g_getMoneyHtml(attr.unnamed, attr.side, items, currency, attr.achievement); + } + }, + npc: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_npcs[id] && g_npcs[id][nameCol]) + { + var npc = g_npcs[id]; + return '' + Markup._safeHtml(npc[nameCol]) + ''; + } + return '(' + LANG.types[1][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_npcs[id] && g_npcs[id][nameCol]) + return Markup._safeHtml(g_npcs[id][nameCol]); + return LANG.types[1][0] + ' #' + id; + } + }, + petability: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_petabilities[id] && g_petabilities[id][nameCol]) + { + var ability = g_petabilities[id]; + return '' + Markup._safeHtml(ability[nameCol]) + ''; + } + return '(' + LANG.types[200][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_petabilities[id] && g_petabilities[id][nameCol]) + return Markup._safeHtml(g_petabilities[id][nameCol]); + return LANG.types[200][0] + ' #' + id; + } + }, + object: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_objects[id] && g_objects[id][nameCol]) + { + var obj = g_objects[id]; + return '' + Markup._safeHtml(obj[nameCol]) + ''; + } + return '(' + LANG.types[2][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_objects[id] && g_objects[id][nameCol]) + return Markup._safeHtml(g_objects[id][nameCol]); + return LANG.types[2][0] + ' #' + id; + } + }, + ol: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedChildren: { li: 1 }, + toHtml: function(attr) + { + var open = ' 0) + open += ' class="' + classes.join(' ') + '"'; + open += Markup._addGlobalAttributes(attr) + '>'; + return [open, '']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n" + Array(depth + 1).join("\t") + '[ol]' + Markup.tags.ol.fromHtml(m[i][0], depth + 1) + "\n" + Array(depth + 1).join("\t") + '[/ol]'); + } + } + + return str; + } + }, + p: + { + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + return ['

    ','

    ']; + }, + fromHtml: function(str) + { + var m; + if(m = str.match(/[\s\S]*?<\/p>/gi)) + { + for(var i = 0; i < m.length; ++i) + { + var align = m[i].match(/^([\s\S]*?)<\/p>/i); + + str = str.replace(m[i], '[pad][div' + (align ? ' align=' + align[1] : '') + ']' + (inside ? inside[1] : '') + '[/div][pad]'); + + } + } + return str; + } + }, + pad: + { + empty: true, + block: true, + trim: true, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = '
    '; + return str; + } + }, + pet: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_pet_families && g_pet_families[id] && g_pets && g_pets[id]) + { + var str = ''; + str += '' + Markup._safeHtml(g_pet_families[id]) + ''; + return str; + } + return '(' + LANG.types[9][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + + if(g_pet_families && g_pet_families[id]) + return Markup._safeHtml(g_pet_families[id]); + return LANG.types[9][0] + ' #' + id; + } + }, + pre: + { + empty: false, + block: true, + rtrim: true, + toHtml: function(attr) + { + var open = '
    ';
    +				return [open, '
    ']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/pre>/gi, '[pre]$1[/pre]'); + } + }, + quest: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_quests[id] && g_quests[id][nameCol]) + { + var quest = g_quests[id]; + return ' ' + Markup._safeHtml(quest[nameCol]) + ''; + } + return '(' + LANG.types[5][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_quests[id] && g_quests[id][nameCol]) + return Markup._safeHtml(g_quests[id][nameCol]); + return LANG.types[5][0] + ' #' + id; + } + }, + quote: + { + block: true, + empty: false, + rtrim: true, + ltrim: true, + itrim: true, + attr: + { + unnamed: { req: false, valid: /[\S ]+/ }, + url: { req: false, valid: /\S+/ }, + blizzard: { req: false, valid: /^true$/ }, + pname: { req: false }, + wowhead: { req: false, valid: /^true$/ }, + display: { req: false, valid: /^block$/ }, + align: { req: false, valid: /^(left|right|center)$/i }, + collapse: { req: false, valid: /^true$/ } + }, + allowedModes: { article: 1, quickfacts: 1, comment: 1 }, + validate: function(attr) { + if(attr.blizzard || attr.wowhead || attr.collapse || attr.url) + { + if(Markup.allow < Markup.CLASS_STAFF) + return false; + } + return true; + }, + toHtml: function(attr) + { + var str = '= 0) pname = 'Blue Tracker'; + // override with attr.pname if it exists + if(typeof(attr.pname) != 'undefined') pname = attr.pname; + + var username = attr.unnamed.trim(); + if(username.length <= 0) + return ['','']; + str = str.replace('class="quote', 'class="quote-blizz'); + str += (attr.collapse ? ' collapse' : '') + '">
    ' + + var matches = url.match(/https?:\/\/(us|eu)\.battle\.net\/wow\/en\/blog\/([0-9]+)/i) || url.match(/https?:\/\/(us|eu)\.battle\.net\/wow\/en\/forum\/topic\/([0-9]+)/i); + + if(matches) { + str += 'Originally posted by Blizzard (Official Post' + + var topicId = matches[2]; + str += ' | Blue Tracker)' + + '

    ' + username + '

    '; + } + else + str += ( + attr.url && Markup._isUrlSafe(attr.url) ? + 'Originally posted by Blizzard ' + + '(' + pname + ')' + + '

    ' + :'

    ' + username + '

    ' + ); + + return [str, '
    ']; + + } + return ['','']; + } + else if(attr.wowhead /*Markup.inBlog*/) + { + str = str.replace('class="quote', 'class="quote-wh'); + str += (attr.collapse ? ' collapse' : '') + '">'; + str += '
    '; + return [str, '
    ']; + } + else + { + str += '">'; + if(attr.unnamed) + { + var username = attr.unnamed.trim(); + if(username.length > 0) + { + str += ''; + if(attr.url && Markup._isUrlSafe(attr.url)) + str += '' + username + ''; + else if(g_isUsernameValid(username)) + str += '' + username + ''; + else + str += username; + str += ' '+ LANG.markup_said + '
    '; + } + } + return [str, '']; + } + } + }, + race: + { + empty: true, + allowInReplies: true, + valid: { 1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true, 9: true, 10: true, 11: true, 22: true, 24: true, 25: true }, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + gender: { req: false, valid: /^(0|1)$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + if(Markup.tags.race.valid[attr.unnamed]) + return true; + return false; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var gender = attr.gender | 0; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_races[id] && g_races[id][nameCol]) + { + var race = g_races[id]; + return ' ' + Markup._safeHtml(race[nameCol]) + ''; + } + return '(' + LANG.types[14][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_races[id] && g_races[id][nameCol]) + return Markup._safeHtml(g_races[id][nameCol]); + return LANG.types[14][0] + ' #' + id; + } + }, + reveal: + { + empty: false, + rtrim: true, + ltrim: true, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + if(!Markup.inBlog || Markup.inBlog > 1) + return ['', '']; + + return [' (read more)']; + Markup.reveals++; + } + }, + s: + { + empty: false, + allowInReplies: true, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/del>/gi, '[s]$1[/s]'); + } + }, + screenshot: + { + empty: false, + attr: + { + id: { req: false, valid: /^[0-9]+$/ }, + url: { req: false, valid: /\S+/ }, + thumb: { req: false, valid: /\S+/ }, + size: { req: false, valid: /^(thumb|resized|normal)$/i }, + width: { req: false, valid: /^[0-9]+$/ }, + height: { req: false, valid: /^[0-9]+$/ }, + 'float': { req: false, valid: /^(left|right)$/i }, + border: { req: false, valid: /^[0-9]+$/ } + }, + taglessSkip: true, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if(attr.url && !attr.thumb) + return false; + else if(!attr.id && !attr.url) + return false; + return true; + }, + toHtml: function(attr) + { + var url = ''; + var thumb = ''; + + if(attr.id) + { + url = g_staticUrl + '/uploads/screenshots/normal/' + attr.id + '.jpg'; + + var thumbId = attr.id; + if(attr.thumb && attr.thumb.match(/^[0-9]+$/)) + { + thumbId = attr.thumb; + attr.thumb = null; + } + + thumb = g_staticUrl + '/uploads/screenshots/' + (attr.size ? attr.size : 'thumb') + '/' + thumbId + '.jpg'; + } + else if(attr.url) + url = attr.url; + + if(attr.thumb) + thumb = attr.thumb; + + var caption = attr._contents.replace(/\n/g, '
    '); + + if(!g_screenshots[Markup.uid]) + g_screenshots[Markup.uid] = []; + var str = ''; + + + str += '']; + } + }, + script: + { + ltrim: true, + rtrim: true, + empty: false, + attr: + { + src: { req: false, valid: /^\S+$/ } + }, + allowedClass: MARKUP_CLASS_ADMIN, + allowedChildren: { '': 1 }, + rawText: true, + taglessSkip: true, + toHtml: function(attr) + { + if(attr.src) + { + $.getScript(attr.src, function() { + $.globalEval(attr._contents); + }); + } + else + $.globalEval(attr._contents); + return ['']; + } + }, + section: + { + empty: false, + ltrim: true, + rtrim: true, + trim: true, + allowedClass: MARKUP_CLASS_STAFF, + attr: + { + }, + toHtml: function(attr) + { + return ['
    ', '
    ']; + } + }, + skill: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_skills[id] && g_skills[id][nameCol]) + { + var skill = g_skills[id]; + return ' ' + Markup._safeHtml(skill[nameCol]) + ''; + } + return '(' + LANG.types[15][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_skills[id] && g_skills[id][nameCol]) + return Markup._safeHtml(g_skills[id][nameCol]); + return LANG.types[15][0] + ' #' + id; + } + }, + sig: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ } + }, + allowedClass: MARKUP_CLASS_PREMIUM, + allowedModes: { signature: 1 }, + toHtml: function(attr) + { + return; + return ''; + } + }, + small: + { + empty: false, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/small>/gi, '[small]$1[/small]'); + } + }, + span: + { + empty: false, + attr: + { + unnamed: { req: false, valid: /^(hidden|invisible)$/ }, + tooltip: { req: false, valid: /\S+/ }, + tooltip2: { req: false, valid: /\S+/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = ' 0) + str += ' style="' + styles.join(';') + '"'; + + if(attr.tooltip && Markup.tooltipTags[attr.tooltip]) + str += ' onmouseover="$WH.Tooltip.showAtCursor(event, Markup.tooltipTags[\'' + attr.tooltip + '\'], 0, 0, ' + (Markup.tooltipBare[attr.tooltip] ? 'null' : "'q'") + ', ' + (attr.tooltip2 && Markup.tooltipTags[attr.tooltip2] ? "Markup.tooltipTags['" + attr.tooltip2 + "']" : 'null') + ')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"'; + + str += '>'; + return [str, '']; + } + }, + spell: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + diff: { req: false, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + buff: { req: false, valid: /^true$/ }, + mop: { req: false, valid: /^[0-9]+$/ }, + mopname: { req: false, valid: /\S+/ }, + mopicon: { req: false, valid: /\S+/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + var rel = []; + + if(attr.buff) + rel.push('buff'); + if(attr.diff) + rel.push('diff=' + attr.diff); + if(attr.mop) + rel.push('mop=' + attr.mop); + + if(g_spells[id] && g_spells[id][nameCol]) + { + var spell = g_spells[id]; + return ' ' + Markup._safeHtml(spell[nameCol]) + ''; + } + if(attr.mop && attr.mopname && attr.mopicon && attr.mopicon.indexOf('.jpg', attr.mopicon.length - 4) !== -1) + return ' ' + Markup._safeHtml(attr.mopname) + ''; + return '(' + LANG.types[6][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_spells[id] && g_spells[id][nameCol]) + return Markup._safeHtml(g_spells[id][nameCol]); + return LANG.types[6][0] + ' #' + id; + } + }, + spoiler: + { + block: true, + empty: false, + rtrim: true, + ltrim: true, + itrim: true, + toHtml: function(attr) + { + return ['
    ' + LANG.markup_spoil + '', '']; + } + }, + statistic: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + icon: { req: false, valid: /^false$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_achievements[id] && g_achievements[id][nameCol]) + { + var ach = g_achievements[id]; + return ' ' + Markup._safeHtml(ach[nameCol]) + ''; + } + return '(' + LANG.types[10][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_achievements[id] && g_achievements[id][nameCol]) + return Markup._safeHtml(g_achievements[id][nameCol]); + return LANG.types[10][0] + ' #' + id; + } + }, + style: + { + ltrim: true, + rtrim: true, + empty: false, + allowedClass: MARKUP_CLASS_ADMIN, + allowedChildren: { '': 1 }, + rawText: true, + taglessSkip: true, + toHtml: function(attr) + { + g_addCss(attr._contents); + return ['']; + } + }, + sub: + { + empty: false, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/sub>/gi, '[sub]$1[/sub]'); + } + }, + sup: + { + empty: false, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/sup>/gi, '[sup]$1[/sup]'); + } + }, + tabs: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedClass: MARKUP_CLASS_STAFF, + allowedChildren: { tab: 1 }, + attr: { + name: { req: true, valid: /\S+/ }, + width: { req: false, valid: /^[0-9]+(px|em|\%)$/ } + }, + toHtml: function(attr) { + attr.id = g_urlize(attr.name); + var x = Markup.preview; + var str = '
    '; + str += ''; + str += tab.content; + str += '
    '; + str += ''; + } + + str += ''; + str += ''; + + setTimeout(Markup.createTabs.bind(null, attr, tabs, (x ? 'preview' : '')), 100); + return [str]; + } + }, + tab: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedClass: MARKUP_CLASS_STAFF, + allowedParents: { tabs: 1 }, + attr: { + name: { req:true, valid: /[\S ]+/ }, + icon: { req:false, valid: /\S+/ } + }, + toHtml: function(attr) + { + attr.id = g_urlize(attr.name); + attr.name = $WH.str_replace(attr.name, "_", ' '); + if(typeof(attr['class']) != 'undefined') + attr['class'] = $WH.str_replace(attr['class'], "_", ' '); + return [{content: attr._contents, id: attr.id, name: attr.name, icon: attr.icon, 'class': attr['class']}]; + } + }, + table: + { + //block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedChildren: { tr: 1 }, + attr: + { + border: { req: false, valid: /^[0-9]+$/ }, + cellspacing: { req: false, valid: /^[0-9]+$/ }, + cellpadding: { req: false, valid: /^[0-9]+$/ }, + width: { req: false, valid: /^[0-9]+(px|em|\%)$/ } + }, + toHtml: function(attr) + { + var str = '']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + var border = m[i][1].match(/border[:="]+\s*([0-9]+)/i), + width = m[i][1].match(/width[:="]+\s*([0-9]+)/i), + spacing = m[i][1].match(/cellspacing="([\s\S]+?)"/i), + padding = m[i][1].match(/cellpadding="([\s\S]+?)"/i); + + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n" + Array(depth + 1).join("\t") + '[table' + (border ? ' border=' + border[1] : '') + (width ? ' width=' + width[1] : '') + (spacing ? ' cellspacing=' + spacing[1] : '') + (padding ? ' cellpadding=' + padding[1] : '') + ']' + Markup.tags.table.fromHtml(m[i][0], depth + 1) + "\n" + Array(depth + 1).join("\t") + '[/table]'); + } + } + + return str; + } + }, + tr: { + empty: false, + itrim: true, + allowedChildren: { td: 1 }, + allowedParents: { table: 1 }, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n\t" + Array(depth + 1).join("\t") + '[tr]' + Markup.tags.tr.fromHtml(m[i][0], depth + 1) + "\n" + Array(depth + 1).join("\t") + '[/tr]'); + } + } + + return str; + } + }, + td: + { + empty: false, + itrim: true, + allowedParents: { tr: 1 }, + attr: + { + unnamed: { req: false, valid: /^header$/ }, + align: { req: false, valid: /^(right|left|center|justify)$/i }, + valign: { req: false, valid: /^(top|middle|bottom|baseline)$/i }, + colspan: { req: false, valid: /^[0-9]+$/ }, + rowspan: { req: false, valid: /^[0-9]+$/ }, + width: { req: false, valid: /^[0-9]+(px|em|\%)$/ } + }, + toHtml: function(attr) + { + var str = '<' + (attr.unnamed ? 'th' : 'td') + Markup._addGlobalAttributes(attr); + if(attr.align != undefined) + str += ' align="' + attr.align + '"'; + if(attr.valign != undefined) + str += ' valign="' + attr.valign + '"'; + if(attr.colspan != undefined) + str += ' colspan="' + attr.colspan + '"'; + if(attr.rowspan != undefined) + str += ' rowspan="' + attr.rowspan + '"'; + if(attr.width != undefined) + str += ' style="width: ' + attr.width + '"'; + str += '>'; + return [str, '']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var t = ['td', 'th'], m; + for(var j = 0; j < t.length; ++j) + { + if(m = Markup.matchOuterTags(str, '<' + t[j] + '\\b[\\s\\S]*?>', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + var width = m[i][1].match(/width[:="]+\s*([0-9]+)/i), + align = m[i][1].match(/align="([\s\S]+?)"/i), + valign = m[i][1].match(/valign="([\s\S]+?)"/i), + colspan = m[i][1].match(/colspan="([\s\S]+?)"/i), + rowspan = m[i][1].match(/rowspan="([\s\S]+?)"/i); + + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n\t\t" + Array(depth + 1).join("\t") + '[td' + (t[j] == 'th' ? '=header' : '') + (width ? ' width=' + width[1] : '') + (align ? ' align=' + align[1] : '') + (valign ? ' valign=' + valign[1] : '') + (colspan ? ' colspan=' + colspan[1] : '') + (rowspan ? ' rowspan=' + rowspan[1] : '') + ']' + Markup.tags.td.fromHtml(m[i][0], depth + 1) + '[/td]'); + } + } + } + + return str; + } + }, + time: + { + empty: true, + count: 0, + attr: + { + until: { req: false, valid: /^\d+$/ }, + since: { req: false, valid: /^\d+$/ }, + server: { req: false, valid: /^true$/ } + }, + validate: function(attr) + { + if(!attr.until && !attr.since) + return false; + return true; + }, + toHtml: function(attr) + { + var id = Markup.tags.time.count++; + var str = '' + Markup.tags.time.getTime(attr) + ''; + setInterval(Markup.tags.time.updateTime.bind(null, id, attr), 5000); + return str; + }, + getTime: function(attr) + { + var now; + if(attr.server) + now = g_serverTime.getTime() / 1000; + else + now = (new Date()).getTime() / 1000; + var delay = 0; + if(attr.until) + delay = attr.until - now; + else + delay = now - attr.since; + + if(delay > 0) + return g_formatTimeElapsed(delay); + else + return '0 ' + LANG.timeunitspl[6]; + }, + updateTime: function(id, attr) + { + var span = $WH.ge('markupTime' + id); + if(!span) + return; + + span.firstChild.nodeValue = Markup.tags.time.getTime(attr); + } + }, + toc: + { + block: true, + post: true, + trim: true, + ltrim: true, + rtrim: true, + collect: { h2: 1, h3: 1 }, + exclude: { tabs: { h2: 1, h3: 1 }, minibox: { h2: 1, h3: 1 } }, + allowedClass: MARKUP_CLASS_STAFF, + attr: + { + h3: { req: false, valid: /^false$/ } + }, + postHtml: function(attr, nodes) + { + var str = ' 0) + str += ' class="' + classes.join(' ') + '"'; + str += Markup._addGlobalAttributes(attr) + '>' + LANG.markup_toc + '
      '; + var lastNode = ""; + var indent = 1; + var allowH3 = (attr.h3 != 'false'); + var myNodes = []; + for(var node in nodes.h2) + myNodes.push(nodes.h2[node]); + for(var node in nodes.h3) + myNodes.push(nodes.h3[node]); + myNodes.sort(function(a, b) { + return a.offset - b.offset; + }); + + for(var i in myNodes) + { + node = myNodes[i]; + if(node.name == 'h2' && node.attr.toc != 'false') + { + if(lastNode == 'h3') + { + str += '
    '; + indent--; + } + str += '
  • ' + node.attr._textContents + '
  • '; + lastNode = 'h2'; + } + if(node.name == 'h3' && allowH3 && node.attr.toc != 'false' && (lastNode != '' || nodes.h2.length == 0)) + { + if(lastNode == 'h2') + { + str += ''; + } + return str; + } + }, + toggler: + { + empty: false, + attr: + { + id: { req: true, valid: /^[a-z0-9_-]+$/i }, + unnamed: { req: false, valid: /^hidden$/i } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = ''; + return [str, '']; + } + }, + tooltip: + { + empty: false, + attr: + { + unnamed: { req: false, valid: /\S+/ }, + name: { req: false, valid: /\S+/ }, + bare: { req: false, valid: /^true$/i }, + label: { req: false, valid: /[\S ]+/ } + }, + taglessSkip: true, + allowedClass: MARKUP_CLASS_STAFF, + validate: function(attr) + { + if(!attr.unnamed && !attr.name) + return false; + return true; + }, + toHtml: function(attr) + { + if(attr.unnamed) + return ['', '']; + else + { + Markup.tooltipTags[attr.name] = (attr.label ? '
    ' + attr.label + '
    ' : '') + attr._contents; + if(attr.bare) + Markup.tooltipBare[attr.name] = true; + return ['']; + } + } + }, + u: + { + empty: false, + allowInReplies: true, + toHtml: function(attr) + { + return ['', '']; + }, + fromHtml: function(str) + { + return str.replace(/<(ins|u)\b[\s\S]*?>([\s\S]*?)<\/\1>/gi, '[u]$2[/u]'); + } + }, + ul: + { + block: true, + empty: false, + ltrim: true, + rtrim: true, + itrim: true, + allowedChildren: { li: 1 }, + toHtml: function(attr) + { + var open = ' 0) + open += ' class="' + classes.join(' ') + '"'; + open += Markup._addGlobalAttributes(attr) + '>'; + return [open, '']; + }, + fromHtml: function(str, depth) + { + depth = depth || 0; + + var m; + if(m = Markup.matchOuterTags(str, '', '', 'g')) + { + for(var i = 0; i < m.length; ++i) + { + str = str.replace(m[i][1] + m[i][0] + m[i][2], "\n" + Array(depth + 1).join("\t") + '[ul]' + Markup.tags.ul.fromHtml(m[i][0], depth + 1) + "\n" + Array(depth + 1).join("\t") + '[/ul]'); + } + } + + return str; + } + }, + url: + { + allowedClass: MARKUP_CLASS_USER, + allowInReplies: true, + empty: false, + helpText: '[url=http://www.google.com]' + LANG.markup_url + '[/url]', + attr: + { + unnamed: { req: false, valid: /\S+/ }, + rel: { req: false, valid: /(item|quest|spell|achievement|npc|object)=([0-9]+)/ }, + onclick: { req: false, valid: /[\S ]+/ }, + tooltip: { req: false, valid: /\S+/ }, + tooltip2: { req: false, valid: /\S+/ } + }, + validate: function(attr) + { + if(attr.onclick && Markup.allow < Markup.CLASS_ADMIN) + return false; + + if(attr.tooltip && Markup.allow < Markup.CLASS_STAFF) + return false; + + var target = ''; + if(attr.unnamed && /^(mailto:|irc:)/i.test(attr.unnamed.trim()) && Markup.allow < Markup.CLASS_STAFF) + return false; + + if(attr.unnamed && /^(javascript:)/i.test(attr.unnamed.trim())) + return false; + + return true; + }, + toHtml: function(attr) + { + var target; + if(attr.unnamed) // in the form [url=blah] + { + target = attr.unnamed; + target = target.replace(/&/, '&'); + if(!target.match(/^([^:\\.\/]+):/i) && target.charAt(0) != '/' && target.charAt(0) != '#') + target = '/' + target; + if(Markup._isUrlSafe(target, true)) + { + var pre = '']; + } + else + { + return ['', '']; + } + } + else // [url]blah[/url] + { + target = attr._textContents; + target = target.replace(/&/, '&'); + if(Markup._isUrlSafe(target)) + { + var pre = '']; + } + else + { + return ['', '']; + } + } + }, + fromHtml: function(str) + { + return str.replace(/([\s\S]*?)<\/a>/gi, '[url=$1]$2[\/url]'); + } + }, + video: + { + empty: true, + attr: + { + id: { req: true, valid: /^[0-9]+$/ }, + unnamed: { req: false, valid: /^embed$/i }, + 'float': { req: false, valid: /^(left|right)$/i }, // Thumbnail only + border: { req: false, valid: /^[0-9]+$/ } // Thumbnail only + }, + ltrim: true, + rtrim: true, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + if(g_videos[attr.id]) + { + var html = '', video = g_videos[attr.id]; + if(attr.unnamed) + { + if(video.videoType == 1) // YouTube + html += Markup.toHtml('[youtube=' + video.videoId + ']', { skipReset: true }); + } + else + { + if(!g_videos[Markup.uid]) + g_videos[Markup.uid] = []; + + html += ''; + + g_videos[Markup.uid].push($WH.dO(video)); + } + return html; + } + return 'Video #' + attr.id + ''; + } + }, + visitedpage: + { + empty: false, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + $.post('/visited-page', { id: attr.unnamed }, function() { AchievementCheck(); }); + return ''; + } + }, + wowheadresponse: + { + block: true, + empty: false, + rtrim: true, + ltrim: true, + itrim: true, + attr: + { + unnamed: { req: true, valid: /[\S ]+/ }, + roles: { req: true, valid: /[0-9]+/ } + }, + allowedModes: { article: 1, quickfacts: 1, comment: 1 }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var str = '' + username + ' ' + LANG.markup_said + '
    '; + return [str, '']; + } + }, + youtube: + { + empty: true, + attr: + { + unnamed: { req: true, valid: /\S+/ }, + width: { req: false, valid: /^[0-9]+$/ }, + height: { req: false, valid: /^[0-9]+$/ }, + autoplay: { req: false, valid: /^true$/ } + }, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + var url = 'http://www.youtube.com/v/' + attr.unnamed + '&fs=1&rel=0' + (attr.autoplay ? '&autoplay=1' : ''); + var width = attr.width ? attr.width : 640; + var height = attr.height ? attr.height : 385; + + var html = ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + return html; + }, + fromHtml: function(str) + { + var m; + if(m = str.match(/<\/iframe>/gi)) + { + for(var i = 0; i < m.length; ++i) + { + var source = m[i].match(/src="[\s\S]*?youtube\.com\/embed\/([\s\S]*?)"/i), + width = m[i].match(/width[:="]+\s*([0-9]+)/i), + height = m[i].match(/height[:="]+\s*([0-9]+)/i), + border = m[i].match(/border[:="]+\s*([0-9]+)/i); + + str = str.replace(m[i], '[youtube=' + source[1] + (width ? ' width=' + width[1] : '') + (height ? ' height=' + height[1] : '') + ']'); + } + } + return str; + } + }, + center: + { + empty: false, + allowInReplies: false, + allowedClass: MARKUP_CLASS_STAFF, + toHtml: function(attr) + { + return ['
    ', '
    ']; + }, + fromHtml: function(str) + { + return str.replace(/
    ([\s\S]+?)<\/center>/gi, '[pad][div align=center]$1[/div][pad]'); + } + }, + title: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_titles[id] && g_titles[id][nameCol]) + { + return '' + Markup._safeHtml(g_titles[id][nameCol]) + ''; + } + return '(' + LANG.types[11][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_titles[id] && g_titles[id][nameCol]) + return Markup._safeHtml(g_titles[id][nameCol]); + return LANG.types[11][0] + ' #' + id; + } + }, + zone: + { + empty: true, + allowInReplies: true, + attr: + { + unnamed: { req: true, valid: /^[0-9]+$/ }, + domain: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ }, + site: { req: false, valid: /^(beta|mop|ptr|www|de|es|fr|ru|pt)$/ } + }, + validate: function(attr) + { + if((attr.domain || attr.site) && Markup.dbpage) + return false; + return true; + }, + toHtml: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var url = domainInfo[0]; + var nameCol = domainInfo[1]; + + if(g_gatheredzones[id] && g_gatheredzones[id][nameCol]) + { + return '' + Markup._safeHtml(g_gatheredzones[id][nameCol]) + ''; + } + return '(' + LANG.types[7][0] + ' #' + id + ')'; + }, + toText: function(attr) + { + var id = attr.unnamed; + var domainInfo = Markup._getDatabaseDomainInfo(attr); + var nameCol = domainInfo[1]; + + if(g_gatheredzones[id] && g_gatheredzones[id][nameCol]) + return Markup._safeHtml(g_gatheredzones[id][nameCol]); + return LANG.types[7][0] + ' #' + id; + } + } + }, + + _addGlobalAttributes: function(attr) + { + var attribs = ''; + if(Markup.allow < Markup.CLASS_STAFF) + return attribs; + if(attr.id) + attribs += ' id="' + attr.id + '"'; + if(attr.title) + attribs += ' title="' + Markup._safeQuotes(attr.title) + '"'; + if(attr['class']) + attribs += ' class="' + attr['class'] + '"'; + if(attr['data-highlight']) + attribs += ' data-highlight="' + attr['data-highlight'] + '"'; + + return attribs; + }, + + _generateTagDocs: function(tagName, helpClass) + { + var tag = Markup.tags[tagName]; + if(!tag) + return ''; + + if(helpClass) + { + if((tag.allowedClass && tag.allowedClass > helpClass) || (!tag.helpText && (tag.empty || tag.allowedParents || tag.allowedChildren || !LANG['markup_' + tagName]))) + return ''; + + if(tag.helpText && typeof tag.helpText == 'function') + var str = tag.helpText(); + else if(tag.helpText && typeof tag.helpText == 'string') + var str = tag.helpText; + else + var str = '[' + tagName + ']' + LANG['markup_' + tagName].toLowerCase() + '[/' + tagName + ']'; + + return '
    ' + str + '
    ' + Markup.toHtml(str, { skipReset: true }) + ''; + } + + var str = '

    Tag: [' + Markup._safeHtml(tagName) + ']

    '; + str += ''; + + if(tag.attr) + { + /*str += '';*/ + str += ''; + } + + str += ''; + + str += ''; + + if(tag.allowedChildren) + { + str += ''; + } + + if(tag.allowedParents) + { + str += ''; + } + + if(tag.presets) + { + str += ''; + } + + if(tag.trim) + { + str += ''; + } + + if(tag.ltrim) + { + str += ''; + } + + if(tag.rtrim) + { + str += ''; + } + + if(tag.itrim) + { + str += ''; + } + + if(tag.block) + { + str += ''; + } + + str += '
    Attributes:'; + for(var a in tag.attr) + { + str += ''; + str += ''; + str += ''; + } + str += '
    ' + a + '
    Required:' + (tag.attr[a].req ? 'Yes' : 'No') + '
    Valid:' + (tag.attr[a].valid ? Markup._safeHtml(tag.attr[a].valid.toString()) : '--') + '
    Attributes:'; + for(var a in tag.attr) + { + str += '
    '; + str += ''; + str += '
    '; + if(a == 'unnamed') + str += 'Self ([' + tagName + '=???])'; + else + str += a; + str += '
    Required:' + (tag.attr[a].req ? 'Yes' : 'No') + '
    Valid:' + (tag.attr[a].valid ? Markup._safeHtml(tag.attr[a].valid.toString()) : '--') + '
    '; + } + str += '
    Has closing tag:' + (tag.empty ? 'No' : 'Yes') + '
    Required group:'; + if(tag.allowedClass == MARKUP_CLASS_ADMIN) + str += 'Administrator'; + else if(tag.allowedClass == MARKUP_CLASS_STAFF) + str += 'Staff'; + else if(tag.allowedClass == MARKUP_CLASS_PREMIUM) + str += 'Premium'; + else if(tag.allowedClass && tag.allowedClass != MARKUP_CLASS_PENDING) + str += 'Not pending'; + else + str += 'None'; + str += '
    Allowed children:'; + for(var t in tag.allowedChildren) + str += Markup._safeHtml(t) + '
    '; + str += '
    Allowed parents:'; + for(var t in tag.allowedParents) + str += Markup._safeHtml(t) + '
    '; + str += '
    Preset values:'; + for(var p in tag.presets) + str += ''; + str += '
    ' + p + '' + Markup._safeHtml(tag.presets[p]) + '
    Trim whitespace
    Trim preceding whitespace
    Trim following whitespace
    Trim whitespace around interior content
    Automatically remove top padding if not the first item
    '; + + return str; + }, + + _init: function() + { + if(!this.inited) + { + var ltrimTags = [], rtrimTags = [], trimTags = []; + for(var tag in Markup.tags) + { + if(Markup.tags[tag].block) + this.firstTags[tag] = true; + if(Markup.tags[tag].exclude) + { + for(var ex in Markup.tags[tag].exclude) + { + if(!this.excludeTags[ex]) + this.excludeTags[ex] = {}; + this.excludeTags[ex][tag] = Markup.tags[tag].exclude[ex]; + } + } + if(Markup.tags[tag].post) + this.postTags.push(tag); + if(Markup.tags[tag].trim) + trimTags.push(tag); + if(Markup.tags[tag].ltrim) + ltrimTags.push(tag); + if(Markup.tags[tag].rtrim) + rtrimTags.push(tag); + } + + if(ltrimTags.length > 0) + this.ltrimRegex = new RegExp('\\s*\\[(' + ltrimTags.join('|') + ')([^a-z0-9]+.*)?]', 'ig'); + if(rtrimTags.length > 0) + this.rtrimRegex = new RegExp('\\[\/(' + rtrimTags.join('|') + ')\\]\\s*', 'ig'); + if(trimTags.length > 0) + this.trimRegex = new RegExp('\\s*\\[(' + trimTags.join('|') + ')([^\\[]*)?\\]\\s*', 'ig'); + + this.inited = true; + + $('[data-highlight]') + .live('mouseenter', function() { + var _ = $(this).attr('data-highlight').split(':'); + + if(_.length != 2) + return; + + var elem = $('#' + _[0]).get(0), + start = parseInt(_[1]), + text = $(elem).val(); + + if(!elem || !start || !text) + return; + + var top = $(elem).val(text.substr(0, start))[0].scrollHeight; + + $(elem).val(text).animate({ scrollTop: top }, 250); + elem.selectionStart = start; + elem.selectionEnd = start; + }); + } + }, + + _safeJsString: function(str) + { + return str.replace(/'/g, '\''); + }, + + _safeQuotes: function(str) + { + return str.replace('"', '\"').replace("'", "\'"); + }, + + _safeHtml: function(html) + { + var allowedEscapes = ['nbsp', 'ndash']; + html = html.replace(/&/g, '&'); + if(allowedEscapes.length > 0) + html = html.replace(new RegExp('&(' + allowedEscapes.join('|') + ');', 'g'), '&$1;'); + return html.replace(//g, '>').replace(/"/g, '"'); + }, + + _preText: function(str) + { + str = Markup._safeHtml(str); + str = str.replace(/\n/g, '
    '); + return str; + }, + + _getDatabaseDomainInfo: function(attr) + { + var url = ''; + var nameCol = Markup.nameCol; + + var domain = false; + if(attr.domain) + domain = attr.domain; + else if(attr.site) + domain = attr.site; + else if(Markup.defaultSource) + domain = MarkupSourceMap[Markup.defaultSource]; + + if(domain) + { + if(domain == 'beta') + domain = 'mop'; + url = 'http://' + domain + '.wowhead.com'; + nameCol = 'name_' + Markup.domainToLocale[domain]; + } + else if(location.href.indexOf('wowheadnews.com') != -1) + url = 'http://www.wowhead.com'; + + return [url, nameCol, domain]; + }, + + _isUrlSafe: function(str, extras) + { + if(!str) + return true; + if(str == 'javascript:;') + return true; + + var result = str.match(/^([^:\\./]+):/i); + + if(result && result[1]) + { + var protocol = result[1]; + + if(protocol == 'http' || protocol == 'https') + return true; + + if(extras && (protocol == 'mailto' || protocol == 'irc')) + return true; + + if(protocol != 'mailto' && str.indexOf('://') == -1) + return true; + + return false; + } + + return true; + }, + + _fixUrl: function(url) + { + if(!url) return ''; + + // Make local URLs absolute + var firstChar = url.charAt(0); + if(firstChar == '/' || firstChar == '?') + { + url = url.replace(/^[\/\?]+/, ''); + + // url = '/' + url; + url = '?' + url; + } + + return url; + }, + + _isUrlExternal: function(str) + { + if(!str) + return false; + return (str.indexOf('wowhead.com') == -1 && str.match(/^([^:\\./]+):/i)); + }, + + _nodeSearch: function(node, name, depth) + { + if(!depth) depth = 0; + if(depth >= 3) return; + if(node.name == name) + return true; + else if(node.parent) + return Markup._nodeSearch(node.parent, name, depth+1); + }, + + _parse: function(str, opts) + { + Markup.nameCol = 'name_' + g_locale.name; + if(opts && opts.locale) + Markup.nameCol = 'name_' + Markup.domainToLocale[opts.locale]; + else if($WH.isset('g_beta') && g_beta) + Markup.nameCol = 'name_beta'; + else if($WH.isset('g_ptr') && g_ptr) + Markup.nameCol = 'name_ptr'; + else if($WH.isset('g_old') && g_old) + Markup.nameCol = 'name_old'; + + if(!str) + str = ""; + + str = str.replace(/\r/g, ''); + + if(!opts) opts = {}; + if(!opts.skipReset) + { + Markup.uid = opts.uid || 'abc'; + Markup.root = opts.root; + Markup.preview = opts.preview || false; + Markup.dbpage = opts.dbpage || false; + Markup.defaultSource = false; + + if(Markup.uid != 'abc') + g_screenshots[Markup.uid] = []; + } + + if(opts.roles && (opts.roles & (U_GROUP_ADMIN|U_GROUP_EDITOR|U_GROUP_MOD|U_GROUP_BUREAU|U_GROUP_DEV|U_GROUP_BLOGGER)) && opts.mode != Markup.MODE_SIGNATURE) + opts.mode = Markup.MODE_ARTICLE; + Markup.mode = opts.mode || Markup.MODE_ARTICLE; + Markup.allow = opts.allow || Markup.CLASS_STAFF; + Markup.inBlog = opts.inBlog ? opts.inBlog : 0; + + if(opts.stopAtBreak) + { + var breakPos = str.indexOf('[break]'); + if(breakPos != -1) + str = str.substring(0, breakPos); + } + else + str = str.replace('[break]', ''); + + var tree = new MarkupTree(); + str = str.trim(); + //str = Markup._safeHtml(str); + +// Resetting this prop causes TOC not to work when +// there are multiple markup sections on a page. +// this.collectTags = {}; + if(this.postTags.length) + { + for(var i in this.postTags) + { + var tag = this.postTags[i]; + if(str.indexOf('['+tag) != -1) + if(!(Markup.tags[tag].allowedModes && Markup.tags[tag].allowedModes[MarkupModeMap[opts.mode]] == undefined)) + for(var collect in Markup.tags[tag].collect) + this.collectTags[collect] = true; + } + } + + //str = str.replace(this.ltrimRegex, function(match, $1, $2) { return '[' + $1 + ($2 ? $2 : '') + ']'; }); + //str = str.replace(this.rtrimRegex, function(match, $1) { return '[/' + $1 + ']'; }); + //str = str.replace(this.trimRegex, function(match, $1, $2) { return '[' + $1 + ($2 ? $2 : '') + ']'; }); + + str = str.replace(/\n(\s*)\n/g, '\n\n'); + //str = str.replace(/\n/g, '
    '); + + var len = str.length; + var textStart = 0, idx = 0, open = -1, close = -1, goodTag = true, isClose = false; + var getValue = function(str) + { + var quote, space, value; + if(str.charAt(0) == '"' || str.charAt(0) == "'") + { + quote = str.charAt(0); + var end = str.indexOf(quote, 1); + if(end > -1) + { + value = str.substring(1, end); + str = str.substring(end+1).trim(); + return { value: Markup._safeHtml(value), str: str }; + } + } + + space = str.indexOf(' '); + if(space > -1) + { + value = str.substring(0, space); + str = str.substring(space+1).trim(); + } + else + { + value = str; + str = ''; + } + + return { value: value, str: str }; + }; + var unnamedRe = /^\s*[a-z0-9]+\s*=/; + while(idx < len) + { + open = str.indexOf('[', idx); + if(open > -1) + { + idx = open + 1; + if(open > 0 && str.charAt(open-1) == '\\') + { + goodTag = false; + open = -1; + } + else + { + close = str.indexOf(']',idx); + } + } + else + idx = len; + + var tagName, attrs = {}; + + if(opts.highlight && $(opts.highlight)) + attrs['data-highlight'] = opts.highlight + ':' + open; + + if(close > -1) + { + var tagContents = str.substring(open+1, close); + if(tagContents.charAt(0) == '/') + { + isClose = true; + tagName = tagContents.substr(1).trim().toLowerCase(); + } + + if(!isClose) + { + var space = tagContents.indexOf(' '), assign = tagContents.indexOf('='); + var quote; + if((assign < space || space == -1) && assign > -1) + { + tagName = tagContents.substring(0, assign).toLowerCase(); + tagContents = tagContents.substring(assign+1).trim(); + var ret = getValue(tagContents); + tagContents = ret.str; + if(Markup.tags[tagName] == undefined || Markup.tags[tagName].attr == undefined || Markup.tags[tagName].attr.unnamed == undefined) + { + goodTag = false; + } + else + attrs.unnamed = ret.value; + } + else if(space > -1) + { + tagName = tagContents.substring(0, space).toLowerCase(); + tagContents = tagContents.substring(space+1).trim(); + if(tagContents.indexOf('=') == -1) // legacy support, [quote name] + { + if(Markup.tags[tagName] == undefined || Markup.tags[tagName].attr == undefined || Markup.tags[tagName].attr.unnamed == undefined) + { + goodTag = false; } - } else { - if (K == "map") { - if (L.name == "pin") { - B.push(["pin", J, L.other]) + else + attrs.unnamed = tagContents; + tagContents = ''; + } + } + else + { + tagName = tagContents.toLowerCase(); + tagContents = ''; + } + + if(Markup.tags[tagName] == undefined) + { + goodTag = false; + } + else if(goodTag) + { + var tag = Markup.tags[tagName]; + + while(tagContents != '') + { + var attr = ''; + if(!unnamedRe.test(tagContents)) + { + attr = 'unnamed'; + } + else + { + assign = tagContents.indexOf('='); + if(assign == -1) + { + goodTag = false; + break; } - } else { - if (L.name == "li") { - B.push(["", J, L.other]) - } else { - if (L.name != "pin") { - B.push([L.name, J, L.other]) - } + + attr = tagContents.substring(0, assign).trim().toLowerCase(); + tagContents = tagContents.substring(assign+1).trim(); + } + + var ret = getValue(tagContents); + tagContents = ret.str; + if(tag.attr == undefined || tag.attr[attr] == undefined) + { + if(Markup.attributes[attr] == undefined || (Markup.attributes[attr].valid != undefined && !Markup.attributes[attr].valid.test(ret.value))) + { + goodTag = false; + break; } } + attrs[attr] = ret.value; + } + + if(goodTag && tag.attr) + { + for(var a in tag.attr) + { + if(tag.attr[a].req && attrs[a] == undefined) + { + goodTag = false; + break; + } + else if(attrs[a] == undefined) + continue; + + if(tag.attr[a].valid != undefined && !tag.attr[a].valid.test(attrs[a])) + { + goodTag = false; + break; + } + } + + if(goodTag && tag.validate != undefined) { + goodTag = tag.validate(attrs); + } } } } - } else { - D += G.charAt(E); ++E + else if(Markup.tags[tagName] == undefined) + goodTag = false; } - } - if (D.length) { - if (K == "ol" || K == "ul") { - if ($WH.trim(D).length) { - I.push(["", D]) - } - } else { - if (K != "map") { - B.push(["", D]) + else + goodTag = false; + + if(goodTag) + { + if(textStart != open) + { + var s = str.substring(textStart, open).replace(/\\\[/g, '['); + var text = { _rawText: s }; + tree.openTag('', text); } + if(isClose) + goodTag = tree.closeTag(tagName); + else + goodTag = tree.openTag(tagName, attrs); + + if(goodTag) + textStart = idx = close + 1; + else + textStart = open; } + goodTag = true; + isClose = false; + open = close = -1; } - I = Markup._cleanNodes(I); - if (I.length) { - B.push(["li", I]); - I = [] + + if(textStart < len) + { + var s = str.substr(textStart).replace(/\\\[/g, '['); + var text = { _rawText: s }; + tree.openTag('', text); } - return [B, E] + + return tree; }, - _cleanNodes: function(B) { - var D = []; - for (var C = 0, A = B.length; C < A; ++C) { - if (B[C][0] == "") { - if (C == 0) { - B[C][1] = B[C][1].replace(/^\n+/g, "") - } - if (C == B.length - 1) { - B[C][1] = B[C][1].replace(/\n+$/g, "") - } - if (B[C][1] != "") { - D.push(B[C]) - } - } else { - D.push(B[C]) - } + + createMaps: function() + { + for(var i = 0; i < Markup.maps.length; ++i) + { + var m = Markup.maps[i]; + new Mapper({parent: m[0], zone: m[1], coords: m[2], unique: i}); } - return D + Markup.maps = []; }, - _yank: function(D, C) { - var E = {}; - D = " " + D + " "; - for (var B = 0, A = C.length; B < A; ++B) { - if (C[B][1] == "") { - D = D.replace(new RegExp("\\s" + C[B][0] + "\\s", "ig"), - function(F) { - E[C[B][0]] = true; - return " " - }) - } else { - D = D.replace(new RegExp("\\s" + C[B][0] + "\\s*[\\s=:]\\s*(" + C[B][1] + ")\\s", "ig"), - function(G, F) { - E[C[B][0]] = F; - return " " - }) - } + + toHtml: function(str, opts) + { + if(!opts) + opts = {}; + if(!opts.allow) + { + if(opts.roles) + opts.allow = Markup.rolesToClass(opts.roles); + else + opts.allow = Markup.CLASS_STAFF; } - return E + + var tree = Markup._parse(str, opts); + var html = tree.toHtml(); + if(opts.prepend) + html = opts.prepend + html; + if(opts.append) + html += opts['append']; + setTimeout(Markup.createMaps, 250); + return html; }, - _isUrlSafe: function(A) { - if (!A) { - return true + + fromHtml: function(str, depth) + { + // Clean up the html source + str = str.replace(/\n+/g, ''); + str = str.replace(/\s+/g, ' '); + str = str.replace(/> <'); + //str = str.replace(/[\s\S]*?<\/style>/g, ''); + str = str.replace(/<\/?[a-z][a-z0-9]*\b[\s\S]*?>/g, ' '); + str = str.replace(//g, ''); + str = str.replace(/\n[\n]+/g, "\n\n"); + str = str.replace(/[ ]+/g, ' '); + str = str.replace(/\t/g, ' '); + + return $WH.trim(str); }, - _htmlmize: function(B) { - var G = ""; - for (var D = 0, A = B.length; D < A; ++D) { - switch (B[D][0]) { - case "": - G += B[D][1]; - break; - case "": - G += Markup._htmlmize(B[D][1]); - break; - case "minibox": - G += '
    ' + Markup._htmlmize(B[D][1]) + "
    "; - break; - case "code": - G += '
    ' + Markup._htmlmize(B[D][1]) + "
    "; - break; - case "quote": - G += '
    '; - if (B[D][2]) { - var H = $WH.trim(B[D][2]); - if (H.length > 0) { - G += ""; - if (H.match(/[^a-z0-9]/i) == null && H.length >= 4 && H.length <= 16) { - G += '' + H + "" - } else { - G += H - } - G += " " + LANG.markup_said + '
    ' + + removeTags: function(str, opts) + { + var tree = Markup._parse(str, opts); + return tree.tagless(); + }, + + matchOuterTags: function(str, left, right, flags) + { + var g = flags.indexOf('g') > -1, + f = flags.replace(/g/g, ''), + x = new RegExp(left + '|' + right, 'g' + f), // Open or close tag + l = new RegExp(left, f), // Open tag only + a = [], + t, s, m, n; + + do + { + t = 0; + while(m = x.exec(str)) + { + if(l.test(m[0])) + { + if (!t++) + { + s = x.lastIndex; + n = m; } } - G += Markup._htmlmize(B[D][1]) + "
    "; - break; - case "url": - G += '"; - break; - case "li": - G += "
  • " + Markup._htmlmize(B[D][1]) + "
  • "; - break; - case "u": - G += "" + Markup._htmlmize(B[D][1]) + ""; - break; - case "s": - G += "" + Markup._htmlmize(B[D][1]) + ""; - break; - case "pad": - G += '
    ' + Markup._htmlmize(B[D][1]) + "
    "; - break; - case "color": - G += "' + Markup._htmlmize(B[D][1]) + ""; - break; - case "toggler": - var F = B[D][2]; - if (F.id != null) { - G += '
    " + Markup._htmlmize(B[D][1]) + "" - } - break; - case "div": - var F = B[D][2]; - if (F.id != null) { - G += '
    " } - break; - case "icon": - var F = B[D][2]; - F.size = F.size || 'tiny'; - if (F.name != "" && Markup._isUrlSafe(F.name)) { - G += '' - } - break; - case "span": - var F = B[D][2]; - if (F.name != "" && Markup._isUrlSafe(F.name)) { - G += '' - G += Markup._htmlmize(B[D][1]) + '' - } - break; - case "img": - var F = B[D][2]; - if (F.src != "" && Markup._isUrlSafe(F.src)) { - G += '"; - G += " "; - G += "" + g_achievements[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Achievement #' + B[D][2] + ")"; - break; - case "money": - if (_ = Math.floor(B[D][2] / 10000)) - G += '' + _ + " "; - if (_ = Math.floor((B[D][2] % 10000) / 100)) - G += '' + _ + " "; - if (_ = Math.floor(B[D][2]) % 100) - G += '' + _ + ""; - break; - case "class": - if (g_classes[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_classes[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Class #' + B[D][2] + ")"; - break; - case "race": - if (g_races[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_races[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Race #' + B[D][2] + ")"; - break; - case "npc": - if (g_npcs[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_npcs[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(NPC #' + B[D][2] + ")"; - break; - case "skill": - if (g_skills[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_skills[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Skill #' + B[D][2] + ")"; - break; - case "pet": - if (g_pets[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_pets[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Pet #' + B[D][2] + ")"; - break; - case "item": - if (g_items[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_items[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Item #' + B[D][2] + ")"; - break; - case "spell": - if (g_spells[B[D][2]]) { - G += ""; - G += " "; - G += "" + g_spells[B[D][2]]["name_" + g_locale.name] + ""; - } - else - G += '(Spell #' + B[D][2] + ")"; - break; - case "map": - var F = B[D][2]; - if (F.zone != null) { - var E = Markup._htmlmize(B[D][1]); - G += '(Map: Zone #' + parseInt(F.zone) + ", " + E.length + " pin" + (E.length == 1 ? "": "s") + ")"; - Markup.maps.push([F.zone, E]) - } - break; - case "pin": - var F = B[D][2]; - if (!Markup._isUrlSafe(F.url)) { - F.url = "" - } - if (G == "") { - G = [] - } - var C = Markup._htmlmize(B[D][1]).replace(/\n/g, "
    "); - if (F.url && F.url.indexOf("?npc=") != -1) { - C = '' + C + '
    Click to view this NPC' - } - G.push([parseFloat(F.x || 0), parseFloat(F.y || 0), { - label: C, - url: F.url, - type: F.type - }]); - break; - default: - G += "<" + B[D][0] + ">" + Markup._htmlmize(B[D][1]) + "" } - } - return G + } while(t && (x.lastIndex = s)); + + return (a.length ? a : false); }, - _tagless: function(B) { - var E = ""; - for (var C = 0, A = B.length; C < A; ++C) { - switch (B[C][0]) { - case "": - E += B[C][1]; - break; - case "img": - var D = B[C][2]; - if (D.src != "" && Markup._isUrlSafe(D.src)) { - E += "(Image: " + D.src + ")" - } - break; - case "npc": - E += "(NPC #" + B[C][2] + ")"; - break; - case "achievement": - E += "(Achievement #" + B[C][2] + ")"; - break; - case "class": - E += "(Class #" + B[C][2] + ")"; - break; - case "race": - E += "(Race #" + B[C][2] + ")"; - break; - case "skill": - E += "(Skill #" + B[C][2] + ")"; - break; - case "pet": - E += "(Pet #" + B[C][2] + ")"; - break; - case "item": - E += "(Item #" + B[C][2] + ")"; - break; - case "spell": - E += "(Spell #" + B[C][2] + ")"; - break; - case "map": - E += "(Map)"; - break; - case "pin": - break; - default: - E += Markup._tagless(B[C][1]) - } - } - return E + + getImageUploadIds: function(str, opts) + { + var tree = Markup._parse(str, opts); + return tree.imageUploadIds(); }, - toHtml: function(D, C) { - C = C || {}; - C.root = C.root || ""; - if (C.mode != null && C.mode != Markup.MODE_SIGNATURE) { - D = D.replace(/\s*\[(ol|ul|h3)\]/ig, - function(F, E) { - return "[" + E + "]" - }); - D = D.replace(/\[\/(ol|ul|h3|minibox|code|quote)\]\s*/ig, - function(F, E) { - return "[/" + E + "]" - }); - D = D.replace(/\s*\[(pad)\]\s*/ig, - function(F, E) { - return "[" + E + "]" - }) - } - D = Markup._prepare(D, C.mode); - var A = Markup._parseCode(D, C.root, 0)[0]; - var B = Markup._htmlmize(A); - B = B.replace(//g, - function(G, E) { - var F = Markup.links[parseInt(E)]; - return '': '">') + (F.length > 100 ? F.substr(0, 97) + "...": F) + "" - }); - B = B.replace(/\n/g, "
    "); - return B + + printHtml: function(str, div, opts) + { + div = $WH.ge(div); + var html = Markup.toHtml(str, opts); + div.innerHTML = html; + Markup.createMaps(); }, - removeTags: function(D, C) { - C = C || {}; - C.root = C.root || ""; - if (C.mode != null && C.mode != Markup.MODE_SIGNATURE) { - D = D.replace(/\s*\[(ol|ul|h3)\]\s?/ig, - function(F, E) { - return " [" + E + "]" - }); - D = D.replace(/\s?\[\/(ol|ul|h3|minibox|code|quote)\]\s*/ig, - function(F, E) { - return "[/" + E + "]" - }); - D = D.replace(/\s*\[(pad)\]\s*/ig, - function(F, E) { - return "[" + E + "]" - }) + + toggleReveal: function(id) + { + var span = $('#reveal-' + id); + if(span.length == 0) + return; + + var toggle = $('#revealtoggle-' + id); + + if(span.is(':visible')) + { + span.hide(); + toggle.text('(read more)'); + } + else + { + span.show(); + toggle.text('(hide)'); } - D = Markup._prepare(D, C.mode); - var A = Markup._parseCode(D, C.root, 0)[0]; - var B = Markup._tagless(A); - B = B.replace(//g, - function(G, E) { - var F = Markup.links[parseInt(E)]; - return F - }); - B = B.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"'); - return B }, - mapperPreview: function(C) { + + mapperPreview: function(id) + { try { - window.mapper = Markup.maps[C]; - var B = window.open("?edit=mapperpreview", "mapperpreview", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=800,height=540"); - B.focus() - } catch(A) {} + window.mapper = Markup.maps[id]; + var win = window.open('/edit=mapper-preview', 'mapperpreview', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=800,height=540'); + win.focus(); + } catch(e) {} }, - printHtml: function (c, d, b) { - d = $WH.ge(d); - var a = Markup.toHtml(c, b); - d.innerHTML = a; + + createTabs: function(parent, tabs, preview) + { + var _ = new Tabs({parent: $WH.ge('dsf67g4d-' + parent.id + (preview ? '-preview' : '')), forum:1, noScroll: (preview ? true : false)}); + for(var i = 0; i < tabs.length; ++i) + { + var tab = tabs[i]; + _.add(tab.name, {id:parent.id + '-' + tab.id, icon: tab.icon, 'class': tab['class']}); + } + _.flush(); } }; + +var MarkupUtil = { + ltrimText: function(attr) + { + attr._rawText = attr._rawText.ltrim(); + return attr; + }, + rtrimText: function(attr) + { + attr._rawText = attr._rawText.rtrim(); + return attr; + }, + + checkSiblingTrim: function(lastNode, node) + { + if(node.name == '' && (Markup.tags[lastNode.name].rtrim || Markup.tags[lastNode.name].trim)) + node.attr = MarkupUtil.ltrimText(node.attr); + else if(lastNode.name == '' && (Markup.tags[node.name].ltrim || Markup.tags[node.name].trim)) + lastNode.attr = MarkupUtil.rtrimText(lastNode.attr); + return [lastNode, node]; + } +}; + +var MarkupTree = function() +{ + this.nodes = []; + this.currentNode = null; +}; + +MarkupTree.prototype = { + openTag: function(tag, attrs) + { + // Allowed class defaults to pending users + if(tag != '' && Markup.tags[tag] && !Markup.tags[tag].allowedClass) + Markup.tags[tag].allowedClass = MARKUP_CLASS_PENDING; + + if(!Markup.tags[tag]) + { + //document.write('bad tag name: "' + tag + '"
    '); + return false; + } + else if(Markup.tags[tag].allowedModes && Markup.tags[tag].allowedModes[MarkupModeMap[Markup.mode]] == undefined) + { + return false; // tag not allowed in this mode + } + else if(Markup.tags[tag].allowedClass && Markup.tags[tag].allowedClass > Markup.allow) + { + return false; // tag requires a higher user class + } + + if(Markup.mode == MARKUP_MODE_REPLY && !Markup.tags[tag].allowInReplies) + return false; // Not allowed in comment replies + + var node = { name: tag, attr: attrs, parent: null, nodes: [] }; + if(this.currentNode) + node.parent = this.currentNode; + + if(Markup.tags[tag].allowedParents) + { + if(node.parent != null) + { + if(Markup.tags[tag].allowedParents[node.parent.name] === undefined) + return false; + } + else if(Markup.root == undefined || Markup.tags[tag].allowedParents[Markup.root] == undefined) + return false; + } + if(node.parent && Markup.tags[node.parent.name].allowedChildren && Markup.tags[node.parent.name].allowedChildren[tag] == undefined) + return false; + + if(this.currentNode) + { + if(this.currentNode.nodes.length == 0 && node.name == '' && Markup.tags[this.currentNode.name].itrim) + node.attr = MarkupUtil.ltrimText(node.attr); + else if(this.currentNode.nodes.length > 0) + { + var lastNodeIndex = this.currentNode.nodes.length-1; + var result = MarkupUtil.checkSiblingTrim(this.currentNode.nodes[lastNodeIndex], node); + this.currentNode.nodes[lastNodeIndex] = result[0]; + node = result[1]; + } + + if(node.name == '') + { + node.attr._text = Markup._preText(node.attr._rawText); + if(node.attr._text.length > 0) + this.currentNode.nodes.push(node); + } + else + this.currentNode.nodes.push(node); + } + else + { + if(this.nodes.length > 0) + { + var lastNodeIndex = this.nodes.length-1; + var result = MarkupUtil.checkSiblingTrim(this.nodes[lastNodeIndex], node); + this.nodes[lastNodeIndex] = result[0]; + node = result[1]; + } + + if(node.name == '') + { + node.attr._text = Markup._preText(node.attr._rawText); + if(node.attr._text.length > 0) + this.nodes.push(node); + } + else + this.nodes.push(node); + } + + if(!Markup.tags[tag].empty && !Markup.tags[tag].post) + this.currentNode = node; + + return true; + }, + + closeTag: function(tag) + { + if(Markup.tags[tag].empty || Markup.tags[tag].post) // empty tag means no close tag + return false; + if(!this.currentNode) // no tag open, so how are we closing one? + return false; + else if(this.currentNode.name == tag) // valid close + { + if(this.currentNode.nodes.length > 0) + { + var lastNodeIndex = this.currentNode.nodes.length-1; + if(Markup.tags[this.currentNode.name].itrim && this.currentNode.nodes[lastNodeIndex].name == '') + { + var node = this.currentNode.nodes[lastNodeIndex]; + node.attr = MarkupUtil.rtrimText(node.attr); + node.attr._text = Markup._preText(node.attr._rawText); + this.currentNode.nodes[lastNodeIndex] = node; + } + } + + this.currentNode = this.currentNode.parent; + } + else + { // a tag was closed, but doesnt match the current open tag, so probably invalid nesting. attempt to find the matching tag, then fail if we cant + var findLastNode = function(name, nodes) + { + for(var i = nodes.length-1; i >= 0; --i) + { + if(nodes[i].name == name) + return i; + } + return -1; + }; + var idx; + if(this.currentNode.parent) + idx = findLastNode(tag, this.currentNode.parent.nodes); + else + idx = findLastNode(tag, this.nodes); + + if(idx == -1) // no matching tag + return false; + } + + return true; + }, + + toHtml: function() + { + var postNodes = []; + + var collection = {}; + for(var x in Markup.collectTags) + collection[x] = []; + this.tagless(true); + var currentOffset = 0; + var processNodes = function(nodes, depth, exclusions) + { + var str = ''; + for(var i = 0; i < nodes.length; ++i) + { + var node = nodes[i]; + + if(depth == 0 && i == 0 && Markup.firstTags[node.name]) // first in text + node.attr.first = true; + else if(depth > 0 && i == 0 && Markup.firstTags[node.parent.name]) // first in block + node.attr.first = true; + if(i == nodes.length-1 && Markup.firstTags[node.name]) // last thing, block + node.attr.last = true; + + if(Markup.excludeTags[node.name]) + exclusions[node.name] = (exclusions[node.name] ? exclusions[node.name] + 1 : 1); + for(var ex in exclusions) + { + for(var t in Markup.excludeTags[ex]) + { + if(Markup.excludeTags[ex][t][node.name]) + node.attr[t] = false; + } + } + + if(Markup.collectTags[node.name]) + { + node.offset = currentOffset++; + collection[node.name].push(node); + } + if(Markup.tags[node.name].post) + { + var comment = ''; + str += comment; + postNodes.push([node, comment]); + } + else if(Markup.tags[node.name].empty) + { + var html; + if(node.parent && Markup.tags[node.parent.name].rawText) + html = Markup.tags[node.name].toHtml(node.attr, { needsRaw: true }); + else + html = Markup.tags[node.name].toHtml(node.attr); + if(typeof html == 'string') + str += html; + else if(html !== undefined) + { + if(str == '') + str = []; + str.push(html); + } + } + else + { + var contents = arguments.callee(node.nodes, depth+1, exclusions); + node.attr._contents = contents; + node.attr._nodes = node.nodes; + var tags = Markup.tags[node.name].toHtml(node.attr); + if(tags.length == 2) + str += tags[0] + contents + tags[1]; + else if(tags.length == 1) + { + if(typeof tags[0] == 'string') + str += tags[0]; + else + { + if(str == '') + str = []; + str.push(tags[0]); + } + } + } + + if(exclusions[node.name]) + { + exclusions[node.name]--; + if(exclusions[node.name] == 0) + delete exclusions[node.name]; + } + } + return str; + }; + str = processNodes(this.nodes, 0, []); + for(var i = 0; i < postNodes.length; ++i) + { + var node = postNodes[i][0]; + var replace = postNodes[i][1]; + var html = Markup.tags[node.name].postHtml(node.attr, collection); + if(typeof html == 'string') + str = str.replace(replace, html); + } + + return str; + }, + + tagless: function(n) + { + var processNodes = function(nodes) + { + var str = ''; + for(var i = 0; i < nodes.length; ++i) + { + var node = nodes[i]; + var contents = arguments.callee(node.nodes); + if(n) { + node.attr._textContents = contents; + } else + { + node.attr._contents = contents; + } + if(node.name == '') + str += Markup.tags[node.name].toHtml(node.attr, { noLink: true, noNbsp: true }); + else if(Markup.tags[node.name].toText) + str += Markup.tags[node.name].toText(node.attr); + if(!Markup.tags[node.name].taglessSkip) + str += contents; + } + return str; + }; + if(n) + processNodes(this.nodes); + else { + var str = processNodes(this.nodes); + str = str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); + return str; + } + }, + + imageUploadIds: function() + { + var ids = []; + + var processNodes = function(nodes) + { + for(var i = 0; i < nodes.length; ++i) + { + var node = nodes[i]; + if(node.name == 'img' && node.attr.upload) + ids.push(node.attr.upload); + + arguments.callee(node.nodes); + } + }; + processNodes(this.nodes); + return ids; + } +}; + +Markup.tags.modelviewer = Markup.tags.model; // Backwards compatability +Markup.reveals = 0; + +Markup._init(); + +$(document).ready(function() { + $('.quote-header').each(function(i) { + var $this = $(this); + var sibs = $this.siblings(); + if(sibs.hasClass('quote-body')) + { + var a = $('', { href: 'javascript:;', 'class': 'toggle' }); + + a.click(function(header) { + var $head = $(header); + var parent = $head.parent(); + + parent.toggleClass('collapse'); + + if(parent.hasClass('collapse')) + $(this).html('Expand'); + else + $(this).html('Collapse'); + }.bind(a, this)); + + if($(this).parent().hasClass('collapse')) + a.html('Expand'); + else + a.html('Collapse'); + + $this.append(a); + } + }); + + $('.quote-wh').each(function(i) { + var $this = $(this); + var a = $('', { href: 'javascript:;', 'class': 'toggle' }); + + a.click(function(thisObj) { + var $this = $(thisObj); + + $this.toggleClass('collapse'); + + if($this.hasClass('collapse')) + $(this).html('Expand'); + else + $(this).html('Collapse'); + }.bind(a, this)); + + if($(this).hasClass('collapse')) + a.html('Expand'); + else + a.html('Collapse'); + + $this.append(a); + }); +}); diff --git a/template/js/Summary.js b/template/js/Summary.js index df7784fc..6aa33d25 100644 --- a/template/js/Summary.js +++ b/template/js/Summary.js @@ -1152,17 +1152,17 @@ Summary.prototype = { a.onclick = this.selectColumn.bind(this, col); if (this.selected && this.__selected.id == col.id) { a.onmouseover = function() { - Tooltip.show(this, LANG.tooltip_removefocus, 0, 0, 'q'); + $WH.Tooltip.show(this, LANG.tooltip_removefocus, 0, 0, 'q'); }; s.className = 'selected'; } else { a.onmouseover = function() { - Tooltip.show(this, LANG.tooltip_setfocus, 0, 0, 'q'); + $WH.Tooltip.show(this, LANG.tooltip_setfocus, 0, 0, 'q'); }; } - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; $WH.ae(a, s); $WH.ae(div, a); } @@ -1797,8 +1797,8 @@ Summary.prototype = { else { var sp = $WH.ce('span'); sp.onmouseover = Summary.groupOver.bind(a, col.group); - sp.onmousemove = Tooltip.cursorUpdate; - sp.onmouseout = Tooltip.hide; + sp.onmousemove = $WH.Tooltip.cursorUpdate; + sp.onmouseout = $WH.Tooltip.hide; sp.className = 'tip'; $WH.ae(sp, $WH.ct('[' + col.group.length + ' ' + LANG.types[3][3] + ']')); $WH.ae(div, sp); @@ -2185,10 +2185,10 @@ Summary.prototype = { a.className = (_.className ? _.className : 'q1'); a.style.borderBottom = '1px dotted #808080'; a.onmouseover = (function(rating, percent, level, text) { - Tooltip.show(this, rating + ' ' + text + ' (' + $WH.sprintf(LANG.tooltip_combatrating, percent, level) + ')
    ' + LANG.su_toggle + '', 0, 0, 'q'); + $WH.Tooltip.show(this, rating + ' ' + text + ' (' + $WH.sprintf(LANG.tooltip_combatrating, percent, level) + ')
    ' + LANG.su_toggle + '', 0, 0, 'q'); }).bind(a, result, percent, this.level, LANG.traits[row.id][0]); - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; a.onclick = this.toggleRatings.bind(this); $WH.ae(a, $WH.ct(sign + (this.ratingMode ? percent : result))); @@ -2320,14 +2320,14 @@ Summary.prototype = { }, selectColumn: function(col) { - Tooltip.hide(); + $WH.Tooltip.hide(); this.selected = (this.__selected.id == col.id ? null : this.clone.i + col.i); this.refreshAll(); }, deleteColumn: function(col, e) { - Tooltip.hide(); + $WH.Tooltip.hide(); e = $WH.$E(e); @@ -2377,7 +2377,7 @@ Summary.prototype = { }, deleteWeightScale: function(i) { - Tooltip.hide(); + $WH.Tooltip.hide(); this.weights.splice(i, 1); @@ -3078,7 +3078,7 @@ Summary.prototype = { var pos = $WH.g_getCursorPos(event); setTimeout(Menu.showAtXY.bind(null, this.menu, pos.x, pos.y), 1); // Timeout needed for the context menu to be disabled - Tooltip.hide(); + $WH.Tooltip.hide(); } return false; @@ -3616,7 +3616,7 @@ Summary.groupOver = function(group, e) { } if (buff) { - Tooltip.showAtCursor(e, '' + buff + '
    '); + $WH.Tooltip.showAtCursor(e, '' + buff + '
    '); } }; @@ -3677,7 +3677,7 @@ Summary.weightOver = function(weight, e) { buff += '
    ' + leftTd + '
    ' + rightTd + '
    ' + LANG.su_toggle + ''; } - Tooltip.showAtCursor(e, buff); + $WH.Tooltip.showAtCursor(e, buff); }; Summary.socketOver = function(gems, e) { @@ -3696,7 +3696,7 @@ Summary.socketOver = function(gems, e) { } if (buff) { - Tooltip.showAtCursor(e, '' + buff + '
    '); + $WH.Tooltip.showAtCursor(e, '' + buff + '
    '); } }; @@ -3807,8 +3807,8 @@ Summary.funcBox = { } a.onmouseover = Summary.socketOver.bind(a, gems[color]); - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; } if (selected) { @@ -3859,10 +3859,10 @@ Summary.templates = { var sp = $WH.ce('span'); sp.className = 'tip'; sp.onmouseover = function() { - Tooltip.show(this, LANG.tooltip_gains, 0, 0, 'q'); + $WH.Tooltip.show(this, LANG.tooltip_gains, 0, 0, 'q'); }; - sp.onmousemove = Tooltip.cursorUpdate; - sp.onmouseout = Tooltip.hide; + sp.onmousemove = $WH.Tooltip.cursorUpdate; + sp.onmouseout = $WH.Tooltip.hide; $WH.ae(sp, $WH.ct(res)); $WH.ae(td, sp); } @@ -3969,8 +3969,8 @@ Summary.templates = { a.href = 'javascript:;'; a.onclick = this.toggleWeights.bind(this); a.onmouseover = Summary.weightOver.bind(a, weight); - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; $WH.ae(a, $WH.ct(score)); $WH.ae(d, a); } diff --git a/template/js/TalentCalc.js b/template/js/TalentCalc.js index 2c8da699..ea00bb83 100644 --- a/template/js/TalentCalc.js +++ b/template/js/TalentCalc.js @@ -748,7 +748,7 @@ function TalentCalc() { function _bonusPointsOnMouseOver(_this, e) { if (_mode == MODE_PET) { - Tooltip.showAtCursor(e, LANG[_bonusPoints ? "tc_rembon": "tc_addbon"], null, null, "q"); + $WH.Tooltip.showAtCursor(e, LANG[_bonusPoints ? "tc_rembon": "tc_addbon"], null, null, "q"); } } @@ -759,7 +759,7 @@ function TalentCalc() { } function _setLevelCapOnMouseOver(_this, e) { - Tooltip.showAtCursor(e, LANG.tooltip_changelevel, null, null, 'q'); + $WH.Tooltip.showAtCursor(e, LANG.tooltip_changelevel, null, null, 'q'); } function _createArrow(arrowType, width, height) { @@ -1094,12 +1094,12 @@ function TalentCalc() { g_onClick(a, _glyphClick.bind(a, slot)); a.onmouseover = _showGlyphTooltip.bind(null, a, slot); - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; g_onClick(link, _glyphClick.bind(link, slot)); link.onmouseover = _showGlyphTooltip.bind(null, link, slot); - link.onmouseout = Tooltip.hide; + link.onmouseout = $WH.Tooltip.hide; td.oncontextmenu = $WH.rf; } @@ -1210,7 +1210,7 @@ function TalentCalc() { link.onclick = $WH.rf; g_onClick(link, _iconClick.bind(link, talent)); link.onmouseover = _showTooltip.bind(null, link, talent); - link.onmouseout = Tooltip.hide; + link.onmouseout = $WH.Tooltip.hide; var border = $WH.ce('div'), @@ -1376,8 +1376,8 @@ function TalentCalc() { __.href = 'javascript:;'; __.onclick = _bonusPointsOnClick.bind(null, __); __.onmouseover = _bonusPointsOnMouseOver.bind(null, __); - __.onmousemove = Tooltip.cursorUpdate; - __.onmouseout = Tooltip.hide; + __.onmousemove = $WH.Tooltip.cursorUpdate; + __.onmouseout = $WH.Tooltip.hide; $WH.ae(_, __); } @@ -1392,8 +1392,8 @@ function TalentCalc() { __.href = 'javascript:;'; __.onclick = _setLevelCapOnClick.bind(null, __); __.onmouseover = _setLevelCapOnMouseOver.bind(null, __); - __.onmousemove = Tooltip.cursorUpdate; - __.onmouseout = Tooltip.hide; + __.onmousemove = $WH.Tooltip.cursorUpdate; + __.onmouseout = $WH.Tooltip.hide; if (!_opt.profiler) { $WH.ae(_, $WH.ct(' (')); @@ -2461,13 +2461,13 @@ function TalentCalc() { } if (glyph && _this.parentNode.className.indexOf("icon") != 0) { - Tooltip.setIcon(glyph.icon); + $WH.Tooltip.setIcon(glyph.icon); } else { - Tooltip.setIcon(null); + $WH.Tooltip.setIcon(null); } - Tooltip.show(_this, "
    " + upper + "
    " + lower + "
    ") + $WH.Tooltip.show(_this, "
    " + upper + "
    " + lower + "
    ") } function _showTooltip(_this, talent) { @@ -2523,7 +2523,7 @@ function TalentCalc() { buffer += ''; - Tooltip.show(_this, $WH.g_setTooltipLevel(buffer, _getRequiredLevel())); + $WH.Tooltip.show(_this, $WH.g_setTooltipLevel(buffer, _getRequiredLevel())); } function _simplifyGlyphName(name) { diff --git a/template/js/basic.js b/template/js/basic.js index 984fabfa..ecf4d7e7 100644 --- a/template/js/basic.js +++ b/template/js/basic.js @@ -1604,298 +1604,412 @@ $WH.g_staticTooltipLevelClick = function (div, level, noSlider, buff) { //****************************************************************************// $WH.Tooltip = { - create: function (i) { - var g = $WH.ce("div"), - l = $WH.ce("table"), - b = $WH.ce("tbody"), - f = $WH.ce("tr"), - c = $WH.ce("tr"), - a = $WH.ce("td"), - k = $WH.ce("th"), - j = $WH.ce("th"), - h = $WH.ce("th"); - g.className = "wowhead-tooltip"; - k.style.backgroundPosition = "top right"; - j.style.backgroundPosition = "bottom left"; - h.style.backgroundPosition = "bottom right"; - if (i) { - a.innerHTML = i - } - $WH.ae(f, a); - $WH.ae(f, k); - $WH.ae(b, f); - $WH.ae(c, j); - $WH.ae(c, h); - $WH.ae(b, c); - $WH.ae(l, b); - $WH.Tooltip.icon = $WH.ce("p"); - $WH.Tooltip.icon.style.visibility = "hidden"; - $WH.ae($WH.Tooltip.icon, $WH.ce("div")); - $WH.ae(g, $WH.Tooltip.icon); - $WH.ae(g, l); - var e = $WH.ce("div"); - e.className = "wowhead-tooltip-powered"; - $WH.ae(g, e); - $WH.Tooltip.logo = e; - return g - }, - fix: function (d, b, f) { - var e = $WH.gE(d, "table")[0], - h = $WH.gE(e, "td")[0], - g = h.childNodes; - if (g.length >= 2 && g[0].nodeName == "TABLE" && g[1].nodeName == "TABLE") { - g[0].style.whiteSpace = "nowrap"; - var a; - if (g[1].offsetWidth > 300) { - a = Math.max(300, g[0].offsetWidth) + 20 - } else { - a = Math.max(g[0].offsetWidth, g[1].offsetWidth) + 20 - } - if (a > 20) { - d.style.width = a + "px"; - g[0].style.width = g[1].style.width = "100%"; - if (!b && d.offsetHeight > document.body.clientHeight) { - e.className = "shrink" + create: function(htmlTooltip, secondary) { + var + d = $WH.ce('div'), + t = $WH.ce('table'), + tb = $WH.ce('tbody'), + tr1 = $WH.ce('tr'), + tr2 = $WH.ce('tr'), + td = $WH.ce('td'), + th1 = $WH.ce('th'), + th2 = $WH.ce('th'), + th3 = $WH.ce('th'); + + d.className = 'tooltip'; + // d.className = 'wowhead-tooltip'; + + th1.style.backgroundPosition = 'top right'; + th2.style.backgroundPosition = 'bottom left'; + th3.style.backgroundPosition = 'bottom right'; + + if (htmlTooltip) { + td.innerHTML = htmlTooltip; + } + + $WH.ae(tr1, td); + $WH.ae(tr1, th1); + $WH.ae(tb, tr1); + $WH.ae(tr2, th2); + $WH.ae(tr2, th3); + $WH.ae(tb, tr2); + $WH.ae(t, tb); + + if (!secondary) { + $WH.Tooltip.icon = $WH.ce('p'); + $WH.Tooltip.icon.style.visibility = 'hidden'; + $WH.ae($WH.Tooltip.icon, $WH.ce('div')); + $WH.ae(d, $WH.Tooltip.icon); + } + + $WH.ae(d, t); + + if (!secondary) { + var img = $WH.ce('div'); + img.className = 'tooltip-powered'; + // img.className = 'wowheadtooltip-powered'; + $WH.ae(d, img); + $WH.Tooltip.logo = img; + } + + return d; + }, + + getMultiPartHtml: function(upper, lower) { + return '
    ' + upper + '
    ' + lower + '
    '; + }, + + fix: function(tooltip, noShrink, visible) { + var + table = $WH.gE(tooltip, 'table')[0], + td = $WH.gE(table, 'td')[0], + c = td.childNodes; + + tooltip.className = $WH.trim(tooltip.className.replace('tooltip-slider', '')); + + if (c.length >= 2 && c[0].nodeName == 'TABLE' && c[1].nodeName == 'TABLE') { + c[0].style.whiteSpace = 'nowrap'; + + var m = parseInt(tooltip.style.width); + if(!tooltip.slider || !m) { + if (c[1].offsetWidth > 300) { + m = Math.max(300, c[0].offsetWidth) + 20; + } + else { + m = Math.max(c[0].offsetWidth, c[1].offsetWidth) + 20; + } + } + + m = Math.min(320, m); + + if (m > 20) { + tooltip.style.width = m + 'px'; + c[0].style.width = c[1].style.width = '100%'; + + if(tooltip.slider) { + Slider.setSize(tooltip.slider, m - 6); + tooltip.className += ' tooltip-slider'; } - } - } - if (f) { - d.style.visibility = "visible" - } - }, - fixSafe: function (c, b, a) { - if ($WH.Browser.ie) { - setTimeout($WH.Tooltip.fix.bind(this, c, b, a), 1) - } else { - $WH.Tooltip.fix(c, b, a) - } - }, - append: function (c, b) { - var c = $WH.$(c); - var a = $WH.Tooltip.create(b); - $WH.ae(c, a); - $WH.Tooltip.fixSafe(a, 1, 1) - }, - prepare: function () { - if ($WH.Tooltip.tooltip) { - return - } - var b = $WH.Tooltip.create(); - b.style.position = "absolute"; - b.style.left = b.style.top = "-2323px"; - var a = $WH.ge("layers"); - if (!a) { - a = $WH.ce("div"); - a.id = "layers"; - $WH.aef(document.body, a) - } - $WH.ae(a, b); - $WH.Tooltip.tooltip = b; - $WH.Tooltip.tooltipTable = $WH.gE(b, "table")[0]; - $WH.Tooltip.tooltipTd = $WH.gE(b, "td")[0]; - if ($WH.Browser.ie6) { - b = $WH.ce("iframe"); - b.src = "javascript:0;"; - b.frameBorder = 0; - if (a) { - $WH.ae(a, b) - } else { - $WH.ae(document.body, b) - } - $WH.Tooltip.iframe = b - } - }, - set: function (b) { - var a = $WH.Tooltip.tooltip; - a.style.width = "550px"; - a.style.left = "-2323px"; - a.style.top = "-2323px"; - $WH.Tooltip.tooltipTd.innerHTML = b; - a.style.display = ""; - $WH.Tooltip.fix(a, 0, 0) - }, - moveTests: [[null, null], [null, false], [false, null], [false, false]], - move: function (m, l, d, o, c, a) { - if (!$WH.Tooltip.tooltipTable) { - return - } - var k = $WH.Tooltip.tooltip, - g = $WH.Tooltip.tooltipTable.offsetWidth, - b = $WH.Tooltip.tooltipTable.offsetHeight, - p; - k.style.width = g + "px"; - var j, e; - for (var f = 0, h = $WH.Tooltip.moveTests.length; f < h; ++f) { - p = $WH.Tooltip.moveTests[f]; - j = $WH.Tooltip.moveTest(m, l, d, o, c, a, p[0], p[1]); - if ($WH.isset("Ads") && !Ads.intersect(j)) { - e = true; - break - } else { - if (!$WH.isset("Ads")) { - break - } - } - } - if ($WH.isset("Ads") && !e) { - $WH.Tooltip.hiddenAd = Ads.intersect(j, true) - } - k.style.left = j.l + "px"; - k.style.top = j.t + "px"; - k.style.visibility = "visible"; - if ($WH.Browser.ie6 && $WH.Tooltip.iframe) { - var p = $WH.Tooltip.iframe; - p.style.left = j.l + "px"; - p.style.top = j.t + "px"; - p.style.width = g + "px"; - p.style.height = b + "px"; - p.style.display = ""; - p.style.visibility = "visible" - } - }, - moveTest: function (e, l, o, y, c, a, m, b) { - var k = e, - w = l, - f = $WH.Tooltip.tooltip, - i = $WH.Tooltip.tooltipTable.offsetWidth, - q = $WH.Tooltip.tooltipTable.offsetHeight, - g = $WH.g_getWindowSize(), - j = $WH.g_getScroll(), - h = g.w, - p = g.h, - d = j.x, - v = j.y, - u = d, - t = v, - s = d + h, - r = v + p; - if (m == null) { - m = (e + o + i <= s) - } - if (b == null) { - b = (l - q >= t) - } - if (m) { - e += o + c - } else { - e = Math.max(e - i, u) - c - } - if (b) { - l -= q + a - } else { - l += y + a - } - if (e < u) { - e = u - } else { - if (e + i > s) { - e = s - i - } - } - if (l < t) { - l = t - } else { - if (l + q > r) { - l = Math.max(v, r - q) - } - } - if ($WH.Tooltip.iconVisible) { - if (k >= e - 48 && k <= e && w >= l - 4 && w <= l + 48) { - l -= 48 - (w - l) - } - } - return $WH.g_createRect(e, l, i, q) - }, - show: function (f, e, d, b, c) { - if ($WH.Tooltip.disabled) { - return - } - if (!d || d < 1) { - d = 1 - } - if (!b || b < 1) { - b = 1 - } - if (c) { - e = '' + e + "" - } - var a = $WH.ac(f); - $WH.Tooltip.prepare(); - $WH.Tooltip.set(e); - $WH.Tooltip.move(a.x, a.y, f.offsetWidth, f.offsetHeight, d, b) - }, - showAtCursor: function (d, f, c, a, b) { - if ($WH.Tooltip.disabled) { - return - } - if (!c || c < 10) { - c = 10 - } - if (!a || a < 10) { - a = 10 - } - if (b) { - f = '' + f + "" - } - d = $WH.$E(d); - var g = $WH.g_getCursorPos(d); - $WH.Tooltip.prepare(); - $WH.Tooltip.set(f); - $WH.Tooltip.move(g.x, g.y, 0, 0, c, a) - }, - showAtXY: function (d, a, e, c, b) { - if ($WH.Tooltip.disabled) { - return - } - $WH.Tooltip.prepare(); - $WH.Tooltip.set(d); - $WH.Tooltip.move(a, e, 0, 0, c, b) - }, - cursorUpdate: function (b, a, d) { - if ($WH.Tooltip.disabled || !$WH.Tooltip.tooltip) { - return - } - b = $WH.$E(b); - if (!a || a < 10) { - a = 10 - } - if (!d || d < 10) { - d = 10 - } - var c = $WH.g_getCursorPos(b); - $WH.Tooltip.move(c.x, c.y, 0, 0, a, d) - }, - hide: function () { - if ($WH.Tooltip.tooltip) { - $WH.Tooltip.tooltip.style.display = "none"; - $WH.Tooltip.tooltip.visibility = "hidden"; - $WH.Tooltip.tooltipTable.className = ""; - if ($WH.Browser.ie6) { - $WH.Tooltip.iframe.style.display = "none" - } - $WH.Tooltip.setIcon(null); - if ($WH.isset("Ads") && $WH.Tooltip.hiddenAd) { - Ads.reveal(Tooltip.hiddenAd); - $WH.Tooltip.hiddenAd = false - } - } - }, - setIcon: function (a) { - $WH.Tooltip.prepare(); - if (a) { - $WH.Tooltip.icon.style.backgroundImage = "url(" + g_staticUrl + "/images/icons/medium/" + a.toLowerCase() + ".jpg)"; - $WH.Tooltip.icon.style.visibility = "visible" - } else { - $WH.Tooltip.icon.style.backgroundImage = "none"; - $WH.Tooltip.icon.style.visibility = "hidden" - } - $WH.Tooltip.iconVisible = a ? 1 : 0 - } + + if (!noShrink && tooltip.offsetHeight > document.body.clientHeight) { + table.className = 'shrink'; + } + } + } + + if (visible) { + tooltip.style.visibility = 'visible'; + } + }, + + fixSafe: function(p1, p2, p3) { + $WH.Tooltip.fix(p1, p2, p3); + }, + + append: function(el, htmlTooltip) { + var el = $WH.ge(el); + var tooltip = $WH.Tooltip.create(htmlTooltip); + $WH.ae(el, tooltip); + + $WH.Tooltip.fixSafe(tooltip, 1, 1); + }, + + prepare: function() { + if ($WH.Tooltip.tooltip) { + return; + } + + var _ = $WH.Tooltip.create(); + _.style.position = 'absolute'; + _.style.left = _.style.top = '-2323px'; + + $WH.ae(document.body, _); + + $WH.Tooltip.tooltip = _; + $WH.Tooltip.tooltipTable = $WH.gE(_, 'table')[0]; + $WH.Tooltip.tooltipTd = $WH.gE(_, 'td')[0]; + + var _ = $WH.Tooltip.create(null, true); + _.style.position = 'absolute'; + _.style.left = _.style.top = '-2323px'; + + $WH.ae(document.body, _); + + $WH.Tooltip.tooltip2 = _; + $WH.Tooltip.tooltipTable2 = $WH.gE(_, 'table')[0]; + $WH.Tooltip.tooltipTd2 = $WH.gE(_, 'td')[0]; + }, + + set: function(text, text2) { + var _ = $WH.Tooltip.tooltip; + + _.style.width = '550px'; + _.style.left = '-2323px'; + _.style.top = '-2323px'; + + if (text.nodeName) { + $WH.ee($WH.Tooltip.tooltipTd); + $WH.ae($WH.Tooltip.tooltipTd, text); + } + else { + $WH.Tooltip.tooltipTd.innerHTML = text; + } + + _.style.display = ''; + + $WH.Tooltip.fix(_, 0, 0); + + if (text2) { + $WH.Tooltip.showSecondary = true; + var _ = $WH.Tooltip.tooltip2; + + _.style.width = '550px'; + _.style.left = '-2323px'; + _.style.top = '-2323px'; + + if (text2.nodeName) { + $WH.ee($WH.Tooltip.tooltipTd2); + $WH.ae($WH.Tooltip.tooltipTd2, text2); + } + else { + $WH.Tooltip.tooltipTd2.innerHTML = text2; + } + + _.style.display = ''; + + $WH.Tooltip.fix(_, 0, 0); + } + else { + $WH.Tooltip.showSecondary = false; + } + }, + + moveTests: [ + [null, null], // Top right + [null, false], // Bottom right + [false, null], // Top left + [false, false] // Bottom left + ], + + move: function(x, y, width, height, paddX, paddY) { + if (!$WH.Tooltip.tooltipTable) { + return; + } + + var + tooltip = $WH.Tooltip.tooltip, + tow = $WH.Tooltip.tooltipTable.offsetWidth, + toh = $WH.Tooltip.tooltipTable.offsetHeight, + tt2 = $WH.Tooltip.tooltip2, + tt2w = $WH.Tooltip.showSecondary ? $WH.Tooltip.tooltipTable2.offsetWidth : 0, + tt2h = $WH.Tooltip.showSecondary ? $WH.Tooltip.tooltipTable2.offsetHeight : 0, + _; + + tooltip.style.width = tow + 'px'; + tt2.style.width = tt2w + 'px'; + + var + rect, + safe; + + for (var i = 0, len = $WH.Tooltip.moveTests.length; i < len; ++i) { + _ = $WH.Tooltip.moveTests[i]; + + rect = $WH.Tooltip.moveTest(x, y, width, height, paddX, paddY, _[0], _[1]); + break; + } + + tooltip.style.left = rect.l + 'px'; + tooltip.style.top = rect.t + 'px'; + tooltip.style.visibility = 'visible'; + + if ($WH.Tooltip.showSecondary) { + tt2.style.left = rect.l + tow + 'px'; + tt2.style.top = rect.t + 'px'; + tt2.style.visibility = 'visible'; + } + }, + + moveTest: function(left, top, width, height, paddX, paddY, rightAligned, topAligned) { + var + bakLeft = left, + bakTop = top, + tooltip = $WH.Tooltip.tooltip, + tow = $WH.Tooltip.tooltipTable.offsetWidth, + toh = $WH.Tooltip.tooltipTable.offsetHeight, + tt2 = $WH.Tooltip.tooltip2, + tt2w = $WH.Tooltip.showSecondary ? $WH.Tooltip.tooltipTable2.offsetWidth : 0, + tt2h = $WH.Tooltip.showSecondary ? $WH.Tooltip.tooltipTable2.offsetHeight : 0, + winSize = $WH.g_getWindowSize(), + scroll = $WH.g_getScroll(), + bcw = winSize.w, + bch = winSize.h, + bsl = scroll.x, + bst = scroll.y, + minX = bsl, + minY = bst, + maxX = bsl + bcw, + maxY = bst + bch; + + if (rightAligned == null) { + rightAligned = (left + width + tow + tt2w <= maxX); + } + + if (topAligned == null) { + topAligned = (top - Math.max(toh, tt2h) >= minY); + } + + if (rightAligned) { + left += width + paddX; + } + else { + left = Math.max(left - (tow + tt2w), minX) - paddX; + } + + if (topAligned) { + top -= Math.max(toh, tt2h) + paddY; + } + else { + top += height + paddY; + } + + if (left < minX) { + left = minX; + } + else if (left + tow + tt2w > maxX) { + left = maxX - (tow + tt2w); + } + + if (top < minY) { + top = minY; + } + else if (top + Math.max(toh, tt2h) > maxY) { + top = Math.max(bst, maxY - Math.max(toh, tt2h)); + } + + if ($WH.Tooltip.iconVisible) { + if (bakLeft >= left - 48 && bakLeft <= left && bakTop >= top - 4 && bakTop <= top + 48) { + top -= 48 - (bakTop - top); + } + } + + return $WH.g_createRect(left, top, tow, toh); + }, + + show: function(_this, text, paddX, paddY, spanClass, text2) { + if ($WH.Tooltip.disabled) { + return; + } + + if (!paddX || paddX < 1) { + paddX = 1; + } + + if (!paddY || paddY < 1) { + paddY = 1; + } + + if (spanClass) { + text = '' + text + ''; + } + + var coords = $WH.ac(_this); + + $WH.Tooltip.prepare(); + $WH.Tooltip.set(text, text2); + $WH.Tooltip.move(coords.x, coords.y, _this.offsetWidth, _this.offsetHeight, paddX, paddY); + }, + + showAtCursor: function(e, text, paddX, paddY, spanClass, text2) { + if ($WH.Tooltip.disabled) { + return; + } + + if (!paddX || paddX < 10) { + paddX = 10; + } + if (!paddY || paddY < 10) { + paddY = 10; + } + + if (spanClass) { + text = '' + text + ''; + if (text2) { + text2 = '' + text2 + ''; + } + } + + e = $WH.$E(e); + var pos = $WH.g_getCursorPos(e); + + $WH.Tooltip.prepare(); + $WH.Tooltip.set(text, text2); + $WH.Tooltip.move(pos.x, pos.y, 0, 0, paddX, paddY); + }, + + showAtXY: function(text, x, y, paddX, paddY, text2) { + if ($WH.Tooltip.disabled) { + return; + } + + $WH.Tooltip.prepare(); + $WH.Tooltip.set(text, text2); + $WH.Tooltip.move(x, y, 0, 0, paddX, paddY); + }, + + cursorUpdate: function(e, x, y) { // Used along with showAtCursor + if ($WH.Tooltip.disabled || !$WH.Tooltip.tooltip) { + return; + } + + e = $WH.$E(e); + + if (!x || x < 10) { + x = 10; + } + if (!y || y < 10) { + y = 10; + } + + var pos = $WH.g_getCursorPos(e); + $WH.Tooltip.move(pos.x, pos.y, 0, 0, x, y); + }, + + hide: function() { + if ($WH.Tooltip.tooltip) { + $WH.Tooltip.tooltip.style.display = 'none'; + $WH.Tooltip.tooltip.visibility = 'hidden'; + $WH.Tooltip.tooltipTable.className = ''; + + $WH.Tooltip.setIcon(null); + } + + if ($WH.Tooltip.tooltip2) { + $WH.Tooltip.tooltip2.style.display = 'none'; + $WH.Tooltip.tooltip2.visibility = 'hidden'; + $WH.Tooltip.tooltipTable2.className = ''; + } + }, + + setIcon: function(icon) { + $WH.Tooltip.prepare(); + + if (icon) { + $WH.Tooltip.icon.style.backgroundImage = 'url(images/icons/medium/' + icon.toLowerCase() + '.jpg)'; + $WH.Tooltip.icon.style.visibility = 'visible'; + } + else { + $WH.Tooltip.icon.style.backgroundImage = 'none'; + $WH.Tooltip.icon.style.visibility = 'hidden'; + } + + $WH.Tooltip.iconVisible = icon ? 1 : 0; + } }; -if ($WH.isset("$WowheadPower")) { - $WowheadPower.init() -}; +if ($WH.isset('$WowheadPower')) { + $WowheadPower.init(); +} $WH.g_getProfileIcon = function(raceId, classId, gender, level, icon, size) { var raceXclass = { diff --git a/template/js/global.js b/template/js/global.js index 7c223084..65f6f008 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -330,12 +330,6 @@ function g_urlize(str, allowLocales, profile) { return str; } -function g_getLocale(a) { - if (a && g_locale.id == 25) { - return 0 - } - return g_locale.id -} function g_createHeader(c) { var k = $WH.ce("dl"), p = (c == 5); @@ -376,23 +370,23 @@ function g_createHeader(c) { $WH.ae(k, f) } $WH.ae($WH.ge("toptabs-generic"), k); - var b = $WH.ge("topbar-generic"); - if (c != null && c >= 0 && c < mn_path.length) { - c = parseInt(c); + var b = $WH.ge("topbar-generic"); + if (c != null && c >= 0 && c < mn_path.length) { + c = parseInt(c); switch (c) { case 0: // Database Menu.addButtons(b, [ - [0, LANG.menu_browse, null, mn_database], // Browse - [1, mn_tools[7][1], null, mn_tools[7][3]], // Utilities - [2, mn_tools[7][3][1][1], mn_tools[7][3][1][2]] // Random Page - ]); + [0, LANG.menu_browse, null, mn_database], // Browse + Menu.findItem(mn_tools, [8]), // Utilities + Menu.findItem(mn_tools, [8, 4]) // Random Page + ]); break; - case 1: + case 1: // Tools Menu.addButtons(b, [ [0, LANG.calculators, null, mn_tools.slice(0,4)], // Calculators - [1, mn_tools[4][1], mn_tools[4][2]], // Maps - [2, mn_tools[7][1], null, mn_tools[7][3]], // Utilities - [3, mn_tools[6][1], null, mn_tools[6][3]] // Guides + Menu.findItem(mn_tools, [1]), // Maps + Menu.findItem(mn_tools, [8]), // Utilities + Menu.findItem(mn_tools, [6]), // Guides ]); break; case 2: @@ -402,8 +396,9 @@ function g_createHeader(c) { pr_initTopBarSearch(); break } - } else { - $WH.ae(b, $WH.ct(String.fromCharCode(160))) + } + else { + $WH.ae(b, $WH.ct(String.fromCharCode(160))); } } function g_updateHeader(a) { @@ -637,162 +632,197 @@ function g_addTooltip(b, c, a) { a = "q" } b.onmouseover = function(d) { - Tooltip.showAtCursor(d, c, 0, 0, a) + $WH.Tooltip.showAtCursor(d, c, 0, 0, a) }; - b.onmousemove = Tooltip.cursorUpdate; - b.onmouseout = Tooltip.hide + b.onmousemove = $WH.Tooltip.cursorUpdate; + b.onmouseout = $WH.Tooltip.hide } function g_addStaticTooltip(b, c, a) { if (!a && c.indexOf("") == -1) { a = "q" } b.onmouseover = function(d) { - Tooltip.show(b, c, 0, 0, a) + $WH.Tooltip.show(b, c, 0, 0, a) }; - b.onmouseout = Tooltip.hide + b.onmouseout = $WH.Tooltip.hide } -function g_formatTimeElapsed(e) { - function c(m, l, i) { - if (i && LANG.timeunitsab[l] == "") { - i = 0 - } - if (i) { - return m + " " + LANG.timeunitsab[l] - } else { - return m + " " + (m == 1 ? LANG.timeunitssg[l] : LANG.timeunitspl[l]) - } - } - var g = [31557600, 2629800, 604800, 86400, 3600, 60, 1]; - var a = [1, 3, 3, -1, 5, -1, -1]; - e = Math.max(e, 1); - for (var f = 3, h = g.length; f < h; ++f) { - if (e >= g[f]) { - var d = f; - var k = Math.floor(e / g[d]); - if (a[d] != -1) { - var b = a[d]; - e %= g[d]; - var j = Math.floor(e / g[b]); - if (j > 0) { - return c(k, d, 1) + " " + c(j, b, 1) - } - } - return c(k, d, 0) - } - } - return "(n/a)" + +function g_formatTimeElapsed(delay) { + function OMG(value, unit, abbrv) { + if (abbrv && LANG.timeunitsab[unit] == '') { + abbrv = 0; + } + + if (abbrv) { + return value + ' ' + LANG.timeunitsab[unit]; + } + else { + return value + ' ' + (value == 1 ? LANG.timeunitssg[unit] : LANG.timeunitspl[unit]); + } + } + + var + range = [31557600, 2629800, 604800, 86400, 3600, 60, 1], + subunit = [1, 3, 3, -1, 5, -1, -1]; + + delay = Math.max(delay, 1); + + for (var i = 3, len = range.length; i < len; ++i) { + if (delay >= range[i]) { + var i1 = i; + var v1 = Math.floor(delay / range[i1]); + + if (subunit[i1] != -1) { + var i2 = subunit[i1]; + delay %= range[i1]; + + var v2 = Math.floor(delay / range[i2]); + + if (v2 > 0) { + return OMG(v1, i1, 1) + ' ' + OMG(v2, i2, 1); + } + } + + return OMG(v1, i1, 0); + } + } + + return '(n/a)'; } -function g_formatDate(c, j, a, d, k) { - var f = new Date(); - var b = new Date(); - b.setTime(f.getTime() - (1000 * j)); - var e; - var g = new Date(b.getYear(), b.getMonth(), b.getDate()); - var l = new Date(f.getYear(), f.getMonth(), f.getDate()); - var i = (l.getTime() - g.getTime()); - i /= 1000; - i /= 86400; - i = Math.round(i); - if (j >= 2592000) { - e = LANG.date_on + g_formatDateSimple(a, d) - } else { - if (i > 1) { - e = $WH.sprintf(LANG.ddaysago, i); - if (c) { - var h = new Date(); - h.setTime(a.getTime() + (g_localTime - g_serverTime)); - c.className += " tip"; - c.title = h.toLocaleString() - } - } else { - if (j >= 43200) { - if (f.getDay() == b.getDay()) { - e = LANG.today - } else { - e = LANG.yesterday - } - e = g_formatTimeSimple(b, e); - if (c) { - var h = new Date(); - h.setTime(a.getTime() + (g_localTime - g_serverTime)); - c.className += " tip"; - c.title = h.toLocaleString() - } - } else { - var e = $WH.sprintf(LANG.date_ago, g_formatTimeElapsed(j)); - if (c) { - var h = new Date(); - h.setTime(a.getTime() + (g_localTime - g_serverTime)); - c.className += " tip"; - c.title = h.toLocaleString() - } - } - } - } - if (k == 1) { - e = e.substr(0, 1).toUpperCase() + e.substr(1) - } - if (c) { - $WH.ae(c, $WH.ct(e)) - } else { - return e - } + +function g_GetStaffColorFromRoles(roles) { + if (roles & U_GROUP_ADMIN) { + return 'comment-blue'; + } + if (roles & U_GROUP_GREEN_TEXT) { // Mod, Bureau, Dev + return 'comment-green'; + } + if (roles & U_GROUP_VIP) { // VIP + return 'comment-gold'; + } + + return ''; +} + +function g_formatDate(sp, elapsed, theDate, time, alone) { + var today = new Date(); + var event_day = new Date(); + event_day.setTime(today.getTime() - (1000 * elapsed)); + var txt; + var event_day_midnight = new Date(event_day.getYear(), event_day.getMonth(), event_day.getDate()); + var today_midnight = new Date(today.getYear(), today.getMonth(), today.getDate()); + var delta = (today_midnight.getTime() - event_day_midnight.getTime()); + delta /= 1000; + delta /= 86400; + delta = Math.round(delta); + + if (elapsed >= 2592000) { /* More than a month ago */ + txt = LANG.date_on + g_formatDateSimple(theDate, time); + } + else if (delta > 1) { + txt = $WH.sprintf(LANG.ddaysago, delta); + + if (sp) { + var _ = new Date(); + _.setTime(theDate.getTime() + (g_localTime - g_serverTime)); + sp.className += ' tip'; + sp.title = _.toLocaleString(); + } + } + else if (elapsed >= 43200) { + if (today.getDay() == event_day.getDay()) { + txt = LANG.today; + } + else { + txt = LANG.yesterday; + } + + txt = g_formatTimeSimple(event_day, txt); + + if (sp) { + var _ = new Date(); + _.setTime(theDate.getTime() + (g_localTime - g_serverTime)); + sp.className += ' tip'; + sp.title = _.toLocaleString(); + } + } + else { /* Less than 12 hours ago */ + var txt = $WH.sprintf(LANG.date_ago, g_formatTimeElapsed(elapsed)); + + if (sp) { + var _ = new Date(); + _.setTime(theDate.getTime() + (g_localTime - g_serverTime)); + sp.className += ' tip'; + sp.title = _.toLocaleString(); + } + } + + if (alone == 1) { + txt = txt.substr(0, 1).toUpperCase() + txt.substr(1); + } + + if (sp) { + $WH.ae(sp, $WH.ct(txt)); + } + else { + return txt; + } } function g_formatDateSimple(d, time) { - function __twoDigits(n) { - return (n < 10 ? '0' + n : n); - } + function __twoDigits(n) { + return (n < 10 ? '0' + n : n); + } - var + var b = "", day = d.getDate(), month = d.getMonth() + 1, year = d.getFullYear(); - if (year <= 1970) { - b += LANG.unknowndate_stc; - } + if (year <= 1970) { + b += LANG.unknowndate_stc; + } else { b += $WH.sprintf(LANG.date_simple, __twoDigits(day), __twoDigits(month), year); } - if (time != null) { - b = g_formatTimeSimple(d, b); - } + if (time != null) { + b = g_formatTimeSimple(d, b); + } - return b; + return b; } function g_formatTimeSimple(d, txt, noPrefix) { - function __twoDigits(n) { - return (n < 10 ? '0' + n : n); - } + function __twoDigits(n) { + return (n < 10 ? '0' + n : n); + } - var + var hours = d.getHours(), - minutes = d.getMinutes(); + minutes = d.getMinutes(); - if (txt == null) { - txt = ''; - } + if (txt == null) { + txt = ''; + } - txt += (noPrefix ? ' ' : LANG.date_at); + txt += (noPrefix ? ' ' : LANG.date_at); - if (hours == 12) { - txt += LANG.noon; - } - else if (hours == 0) { - txt += LANG.midnight; - } - else if (hours > 12) { - txt += (hours - 12) + ':' + __twoDigits(minutes) + ' ' + LANG.pm; - } - else { - txt += hours + ':' + __twoDigits(minutes) + ' ' + LANG.am; - } + if (hours == 12) { + txt += LANG.noon; + } + else if (hours == 0) { + txt += LANG.midnight; + } + else if (hours > 12) { + txt += (hours - 12) + ':' + __twoDigits(minutes) + ' ' + LANG.pm; + } + else { + txt += hours + ':' + __twoDigits(minutes) + ' ' + LANG.am; + } - return txt; + return txt; } function g_cleanCharacterName(e) { @@ -972,13 +1002,13 @@ function g_getMoneyHtml2(f, c, b, a) { if (e.length > 0) { e += " " } - e += '' + g_numberFormat(Math.abs(c)) + "" + e += '' + g_numberFormat(Math.abs(c)) + "" } if (b !== undefined && b !== null && b > 0) { if (e.length > 0) { e += " " } - e += '' + g_numberFormat(b) + "" + e += '' + g_numberFormat(b) + "" } if (a !== undefined && a !== null && a.length > 0) { for (var d = 0; d < a.length; ++d) { @@ -1396,10 +1426,10 @@ function g_addPages(l, b) { } }; f.onmouseover = function(d) { - Tooltip.showAtCursor(d, LANG.tooltip_gotopage, 0, 0, "q") + $WH.Tooltip.showAtCursor(d, LANG.tooltip_gotopage, 0, 0, "q") }; - f.onmousemove = Tooltip.cursorUpdate; - f.onmouseout = Tooltip.hide; + f.onmousemove = $WH.Tooltip.cursorUpdate; + f.onmouseout = $WH.Tooltip.hide; $WH.ae(q, f) } if (c) { @@ -1653,20 +1683,8 @@ var VideoViewer = new function() { computeDimensions(); if (!resizing) { - if (video.videoType == 1) { - // imgDiv.innerHTML = Markup.toHtml('[youtube=' + video.videoId + ' width=' + imgWidth + ' height=' + imgHeight + ' autoplay=true]', {mode:Markup.MODE_ARTICLE}); - /* yes container hack .. fuck off */ - var m = 'http://www.youtube.com/collectionId/' + video.videoId + '&fs=1&rel=0&autoplay=1'; - var l = imgWidth ? imgWidth : 640; - var n = imgHeight ? imgHeight : 385; - imgDiv.innerHTML = ''; - imgDiv.innerHTML += ''; - imgDiv.innerHTML += ''; - imgDiv.innerHTML += ''; - imgDiv.innerHTML += ''; - imgDiv.innerHTML += ''; - /* end of hack .. fuck off */ + imgDiv.innerHTML = Markup.toHtml('[youtube=' + video.videoId + ' width=' + imgWidth + ' height=' + imgHeight + ' autoplay=true]', {mode:Markup.MODE_ARTICLE}); } aOriginal.href = $WH.sprintf(vi_siteurls[video.videoType], video.videoId); @@ -2271,9 +2289,9 @@ Tabs.prototype = { } if(tab.tooltip) { - a.onmouseover = (function(tooltip, e) { Tooltip.showAtCursor(e, tooltip, 0, 0, 'q'); }).bind(a, tab.tooltip); - a.onmousemove = Tooltip.cursorUpdate; - a.onmouseout = Tooltip.hide; + a.onmouseover = (function(tooltip, e) { $WH.Tooltip.showAtCursor(e, tooltip, 0, 0, 'q'); }).bind(a, tab.tooltip); + a.onmousemove = $WH.Tooltip.cursorUpdate; + a.onmouseout = $WH.Tooltip.hide; } if (tab['class']) { @@ -2338,9 +2356,9 @@ Tabs.prototype = { _[index].onmouseover = _[index].onmousemove = _[index].onmouseout = null; } else { - _[index].onmouseover = function(e) { Tooltip.showAtCursor(e, text, 0, 0, 'q2'); }; - _[index].onmousemove = Tooltip.cursorUpdate; - _[index].onmouseout = Tooltip.hide; + _[index].onmouseover = function(e) { $WH.Tooltip.showAtCursor(e, text, 0, 0, 'q2'); }; + _[index].onmousemove = $WH.Tooltip.cursorUpdate; + _[index].onmouseout = $WH.Tooltip.hide; } }, @@ -2414,286 +2432,430 @@ Tabs.onShow = function(newTab, oldTab) { }; var g_listviews = {}; -function Listview(a) { - $WH.cO(this, a); - if (this.id) { - var o = (this.tabs ? "tab-": "lv-") + this.id; - if (this.parent) { - var l = $WH.ce("div"); - l.id = o; - $WH.ae($WH.ge(this.parent), l); - this.container = l - } else { - this.container = $WH.ge(o) - } - } else { - return - } - var c = $WH.g_getGets(); - if ((c.debug != null || g_user.debug) && g_user.roles & 26) { - this.debug = true - } - if (this.template && Listview.templates[this.template]) { - this.template = Listview.templates[this.template] - } else { - return - } - g_listviews[this.id] = this; - if (this.data == null) { - this.data = [] - } - if (this.poundable == null) { - if (this.template.poundable != null) { - this.poundable = this.template.poundable - } else { - this.poundable = true - } - } - if (this.searchable == null) { - if (this.template.searchable != null) { - this.searchable = this.template.searchable - } else { - this.searchable = false - } - } - if (this.filtrable == null) { - if (this.template.filtrable != null) { - this.filtrable = this.template.filtrable - } else { - this.filtrable = false - } - } - if (this.data.length == 1) { - this.filtrable = false; - this.searchable = false - } - if (this.searchable && this.searchDelay == null) { - if (this.template.searchDelay != null) { - this.searchDelay = this.template.searchDelay - } else { - this.searchDelay = 333 - } - } - if (this.clickable == null) { - if (this.template.clickable != null) { - this.clickable = this.template.clickable - } else { - this.clickable = true - } - } - if (this.hideBands == null) { - this.hideBands = this.template.hideBands - } - if (this.hideNav == null) { - this.hideNav = this.template.hideNav - } - if (this.hideHeader == null) { - this.hideHeader = this.template.hideHeader - } - if (this.hideCount == null) { - this.hideCount = this.template.hideCount - } - if (this.computeDataFunc == null && this.template.computeDataFunc != null) { - this.computeDataFunc = this.template.computeDataFunc - } - if (this.createCbControls == null && this.template.createCbControls != null) { - this.createCbControls = this.template.createCbControls - } - if (this.template.onBeforeCreate != null) { - if (this.onBeforeCreate == null) { - this.onBeforeCreate = this.template.onBeforeCreate - } else { - this.onBeforeCreate = [this.template.onBeforeCreate, this.onBeforeCreate] - } - } - if (this.onAfterCreate == null && this.template.onAfterCreate != null) { - this.onAfterCreate = this.template.onAfterCreate - } - if (this.onNoData == null && this.template.onNoData != null) { - this.onNoData = this.template.onNoData - } - if (this.createNote == null && this.template.createNote != null) { - this.createNote = this.template.createNote - } - if (this.customFilter == null && this.template.customFilter != null) { - this.customFilter = this.template.customFilter - } - if (this.onSearchSubmit == null && this.template.onSearchSubmit != null) { - this.onSearchSubmit = this.template.onSearchSubmit - } - if (this.clip == null && this.template.clip != null) { - this.clip = this.template.clip - } - if (this.mode == null) { - this.mode = this.template.mode - } - if (this.nItemsPerPage == null) { - if (this.template.nItemsPerPage != null) { - this.nItemsPerPage = this.template.nItemsPerPage - } else { - this.nItemsPerPage = 50 - } - } - this.nItemsPerPage |= 0; - if (this.nItemsPerPage <= 0) { - this.nItemsPerPage = 0 - } - this.nFilters = 0; - this.resetRowVisibility(); - if (this.mode == Listview.MODE_TILED) { - if (this.nItemsPerRow == null) { - var t = this.template.nItemsPerRow; - this.nItemsPerRow = (t != null ? t: 4) - } - this.nItemsPerRow |= 0; - if (this.nItemsPerRow <= 1) { - this.nItemsPerRow = 1 - } - } - else if (this.mode == Listview.MODE_CALENDAR) { - this.dates = []; - this.nItemsPerRow = 7; // Days per row - this.nItemsPerPage = 1; // Months per page - this.nDaysPerMonth = []; - if (this.template.startOnMonth != null) - this.startOnMonth = this.template.startOnMonth; - else - this.startOnMonth = new Date(); - this.startOnMonth.setDate(1); - this.startOnMonth.setHours(0, 0, 0, 0); +function Listview(opt) { + $WH.cO(this, opt); - if (this.nMonthsToDisplay == null) { - if(this.template.nMonthsToDisplay != null) - this.nMonthsToDisplay = this.template.nMonthsToDisplay; - else - this.nMonthsToDisplay = 1; - } - - var y = this.startOnMonth.getFullYear(), - m = this.startOnMonth.getMonth(); - - for (var j = 0; j < this.nMonthsToDisplay; ++j) { - var date = new Date(y, m + j, 32); - this.nDaysPerMonth[j] = 32 - date.getDate(); - for (var i = 1; i <= this.nDaysPerMonth[j]; ++i) - this.dates.push({ date: new Date(y, m + j, i) }); - } - - if (this.template.rowOffset != null) - this.rowOffset = this.template.rowOffset; - } + if (this.id) { + var divId = (this.tabs ? 'tab-' : 'lv-') + this.id; + if (this.parent) { + var d = $WH.ce('div'); + d.id = divId; + $WH.ae($WH.ge(this.parent), d); + this.container = d; + } + else { + this.container = $WH.ge(divId); + } + } else { - this.nItemsPerRow = 1 - } - this.columns = []; - for (var f = 0, k = this.template.columns.length; f < k; ++f) { - var r = this.template.columns[f], - e = {}; - $WH.cO(e, r); - this.columns.push(e) - } - if (this.extraCols != null) { - for (var f = 0, k = this.extraCols.length; f < k; ++f) { - var m = null; - var b = this.extraCols[f]; - if (b.after || b.before) { - var j = $WH.in_array(this.columns, (b.after ? b.after: b.before), function(d) { - return d.id - }); - if (j != -1) { - m = (b.after ? j + 1 : j - 1) - } - } - if (m == null) { - m = this.columns.length - } - if (b.id == "debug-id") { - this.columns.splice(0, 0, b) - } else { - this.columns.splice(m, 0, b) - } - } - } - this.visibility = []; - var p = [], - q = []; - if (this.visibleCols != null) { - $WH.array_walk(this.visibleCols, function(d) { - p[d] = 1 - }) - } - if (this.hiddenCols != null) { - $WH.array_walk(this.hiddenCols, function(d) { - q[d] = 1 - }) - } - for (var f = 0, k = this.columns.length; f < k; ++f) { - var b = this.columns[f]; - if (p[b.id] != null || (!b.hidden && q[b.id] == null)) { - this.visibility.push(f) - } - } - if (this.sort == null && this.template.sort) { - this.sort = this.template.sort.slice(0) - } - if (this.sort != null) { - var h = this.sort; - this.sort = []; - for (var f = 0, k = h.length; f < k; ++f) { - var b = parseInt(h[f]); - if (isNaN(b)) { - var g = 0; - if (h[f].charAt(0) == "-") { - g = 1; - h[f] = h[f].substring(1) - } - var j = $WH.in_array(this.columns, h[f], function(d) { - return d.id - }); - if (j != -1) { - if (g) { - this.sort.push( - (j + 1)) - } else { - this.sort.push(j + 1) - } - } - } else { - this.sort.push(b) - } - } - } else { - this.sort = [] - } - if ((this.debug || g_user.debug) && this.id != "topics" && this.id != "recipes") { - this.columns.splice(0, 0, { - id: "debug-id", - value: "id", - name: "ID", - width: "5%", - tooltip: "ID" - }); - this.visibility.splice(0, 0, -1); - for (var f = 0, k = this.visibility.length; f < k; ++f) { - this.visibility[f] = this.visibility[f] + 1 - } - for (var f = 0, k = this.sort.length; f < k; ++f) { - if (this.sort[f] < 0) { - this.sort[f] = this.sort[f] - 1 - } else { - this.sort[f] = this.sort[f] + 1 - } - } - } - if (this.tabs) { - this.tabIndex = this.tabs.add(this.getTabName(), { - id: this.id, - onLoad: this.initialize.bind(this) - }) - } else { - this.initialize() - } + return; + } + + var get = $WH.g_getGets(); + if ((get.debug != null || g_user.debug) && g_user.roles & U_GROUP_MODERATOR) { + this.debug = true; + } + + if (this.template && Listview.templates[this.template]) { + this.template = Listview.templates[this.template]; + } + else { + return; + } + + g_listviews[this.id] = this; + + if (this.data == null) { + this.data = []; + } + + if (this.poundable == null) { + if (this.template.poundable != null) { + this.poundable = this.template.poundable; + } + else { + this.poundable = true; + } + } + + if (this.searchable == null) { + if (this.template.searchable != null) { + this.searchable = this.template.searchable; + } + else { + this.searchable = false; + } + } + + if (this.filtrable == null) { + if (this.template.filtrable != null) { + this.filtrable = this.template.filtrable; + } + else { + this.filtrable = false; + } + } + + if (this.sortable == null) { + if (this.template.sortable != null) { + this.sortable = this.template.sortable; + } + else { + this.sortable = true; + } + } + + if (this.customPound == null) { + if (this.template.customPound != null) { + this.customPound = this.template.customPound; + } + else { + this.customPound = false; + } + } + + if (this.data.length == 1) { + this.filtrable = false; + this.searchable = false; + } + + if (this.searchable && this.searchDelay == null) { + if (this.template.searchDelay != null) { + this.searchDelay = this.template.searchDelay; + } + else { + this.searchDelay = 333; + } + } + + if (this.clickable == null) { + if (this.template.clickable != null) { + this.clickable = this.template.clickable; + } + else { + this.clickable = true; + } + } + + if (this.hideBands == null) { + this.hideBands = this.template.hideBands; + } + + if (this.hideNav == null) { + this.hideNav = this.template.hideNav; + } + + if (this.hideHeader == null) { + this.hideHeader = this.template.hideHeader; + } + + if (this.hideCount == null) { + this.hideCount = this.template.hideCount; + } + + if (this.computeDataFunc == null && this.template.computeDataFunc != null) { + this.computeDataFunc = this.template.computeDataFunc; + } + + if (this.createCbControls == null && this.template.createCbControls != null) { + this.createCbControls = this.template.createCbControls; + } + + if (this.template.onBeforeCreate != null) { + if (this.onBeforeCreate == null) { + this.onBeforeCreate = this.template.onBeforeCreate; + } + else { + this.onBeforeCreate = [this.template.onBeforeCreate, this.onBeforeCreate]; + } + } + + if (this.onAfterCreate == null && this.template.onAfterCreate != null) { + this.onAfterCreate = this.template.onAfterCreate; + } + + if (this.onNoData == null && this.template.onNoData != null) { + this.onNoData = this.template.onNoData; + } + + if (this.createNote == null && this.template.createNote != null) { + this.createNote = this.template.createNote; + } + + if (this.customFilter == null && this.template.customFilter != null) { + this.customFilter = this.template.customFilter; + } + + if (this.onSearchSubmit == null && this.template.onSearchSubmit != null) { + this.onSearchSubmit = this.template.onSearchSubmit; + } + + if (this.getItemLink == null && this.template.getItemLink != null) { + this.getItemLink = this.template.getItemLink; + } + + if (this.clip == null && this.template.clip != null) { + this.clip = this.template.clip; + } + + if (this.clip || this.template.compute || this.id == 'topics' || this.id == 'recipes') { + this.debug = false; // Don't add columns to picker windows + } + + if (this.mode == null) { + this.mode = this.template.mode; + } + + if (this.template.noStyle != null) { + this.noStyle = this.template.noStyle; + } + + if (this.nItemsPerPage == null) { + if (this.template.nItemsPerPage != null) { + this.nItemsPerPage = this.template.nItemsPerPage; + } + else { + this.nItemsPerPage = 50; + } + } + this.nItemsPerPage |= 0; + if (this.nItemsPerPage <= 0) { + this.nItemsPerPage = 0; + } + + this.nFilters = 0; + this.resetRowVisibility(); + + if (this.mode == Listview.MODE_TILED) { + if (this.nItemsPerRow == null) { + var ipr = this.template.nItemsPerRow; + this.nItemsPerRow = (ipr != null ? ipr : 4); + } + this.nItemsPerRow |= 0; + if (this.nItemsPerRow <= 1) { + this.nItemsPerRow = 1; + } + } + else if (this.mode == Listview.MODE_CALENDAR) { + this.dates = []; + this.nItemsPerRow = 7; // Days per row + this.nItemsPerPage = 1; // Months per page + this.nDaysPerMonth = []; + + if (this.template.startOnMonth != null) { + this.startOnMonth = this.template.startOnMonth; + } + else { + this.startOnMonth = new Date(); + } + + this.startOnMonth.setDate(1); + this.startOnMonth.setHours(0, 0, 0, 0); + + if (this.nMonthsToDisplay == null) { + if (this.template.nMonthsToDisplay != null) { + this.nMonthsToDisplay = this.template.nMonthsToDisplay; + } + else { + this.nMonthsToDisplay = 1; + } + } + + var + y = this.startOnMonth.getFullYear(), + m = this.startOnMonth.getMonth(); + + for (var j = 0; j < this.nMonthsToDisplay; ++j) { + var date = new Date(y, m + j, 32); + this.nDaysPerMonth[j] = 32 - date.getDate(); + for (var i = 1; i <= this.nDaysPerMonth[j]; ++i) { + this.dates.push({ date: new Date(y, m + j, i) }); + } + } + + if (this.template.rowOffset != null) { + this.rowOffset = this.template.rowOffset; + } + } + else { + this.nItemsPerRow = 1; + } + + this.columns = []; + for (var i = 0, len = this.template.columns.length; i < len; ++i) { + var + ori = this.template.columns[i], + cpy = {}; + + $WH.cO(cpy, ori); + + this.columns.push(cpy); + } + + // ************************ + // Extra Columns + + if (this.extraCols != null) { + for (var i = 0, len = this.extraCols.length; i < len; ++i) { + var pos = null; + var col = this.extraCols[i]; + + if (col.after || col.before) { + var index = $WH.in_array(this.columns, (col.after ? col.after: col.before), function(x) { + return x.id; + }); + + if (index != -1) { + pos = (col.after ? index + 1 : index); + } + } + + if (pos == null) { + pos = this.columns.length; + } + + if (col.id == 'debug-id') { + this.columns.splice(0, 0, col); + } + else { + this.columns.splice(pos, 0, col); + } + } + } + + // ************************ + // Visibility + + this.visibility = []; + + var + visibleCols = [], + hiddenCols = []; + + if (this.visibleCols != null) { + $WH.array_walk(this.visibleCols, function(x) { + visibleCols[x] = 1; + }); + } + + if (this.hiddenCols != null) { + $WH.array_walk(this.hiddenCols, function(x) { + hiddenCols[x] = 1; + }); + } + + for (var i = 0, len = this.columns.length; i < len; ++i) { + var col = this.columns[i]; + if (visibleCols[col.id] != null || (!col.hidden && hiddenCols[col.id] == null)) { + this.visibility.push(i); + } + } + + // ************************ + // Sort + + if (this.sort == null && this.template.sort) { + this.sort = this.template.sort.slice(0); + } + + if (this.sort != null) { + var sortParam = this.sort; + this.sort = []; + for (var i = 0, len = sortParam.length; i < len; ++i) { + var col = parseInt(sortParam[i]); + if (isNaN(col)) { + var desc = 0; + if (sortParam[i].charAt(0) == '-') { + desc = 1; + sortParam[i] = sortParam[i].substring(1); + } + var index = $WH.in_array(this.columns, sortParam[i], function(x) { + return x.id; + }); + if (index != -1) { + if (desc) { + this.sort.push( - (index + 1)); + } + else { + this.sort.push(index + 1); + } + } + } + else { + this.sort.push(col); + } + } + } + else { + this.sort = []; + } + + if (this.debug || g_user.debug) { + this.columns.splice(0, 0, { + id: 'debug-id', + compute: function(data, td) { + if (data.id) { + $WH.ae(td, $WH.ct(data.id)); + } + }, + getVisibleText: function(data) { + if (data.id) { + return data.id; + } + else { + return ''; + } + }, + getValue: function(data) { + if (data.id) { + return data.id; + } + else { + return 0; + } + }, + sortFunc: function(a, b, col) { + if (a.id == null) { + return -1; + } + else if (b.id == null) { + return 1; + } + + return $WH.strcmp(a.id, b.id); + }, + name: 'ID', + width: '5%', + tooltip: 'ID' + }); + this.visibility.splice(0, 0, -1); + + for (var i = 0, len = this.visibility.length; i < len; ++i) { + this.visibility[i] = this.visibility[i] + 1; + } + + for (var i = 0, len = this.sort.length; i < len; ++i) { + if (this.sort[i] < 0) { + this.sort[i] = this.sort[i] - 1; + } + else { + this.sort[i] = this.sort[i] + 1; + } + } + } + + if (this.tabs) { + this.tabIndex = this.tabs.add(this.getTabName(), { + id: this.id, + onLoad: this.initialize.bind(this) + }); + } + else { + this.initialize(); + } } + Listview.MODE_DEFAULT = 0; Listview.MODE_CHECKBOX = 1; Listview.MODE_DIV = 2; @@ -2701,1448 +2863,1898 @@ Listview.MODE_TILED = 3; Listview.MODE_CALENDAR = 4; Listview.prototype = { - initialize: function() { - if (this.data.length) { - if (this.computeDataFunc != null) { - for (var d = 0, a = this.data.length; d < a; ++d) { - this.computeDataFunc(this.data[d]) - } - } - } - if (this.tabs) { - this.pounded = (this.tabs.poundedTab == this.tabIndex); - if (this.pounded) { - this.readPound() - } - } else { - this.readPound() - } - this.applySort(); - var b; - if (this.onBeforeCreate != null) { - if (typeof this.onBeforeCreate == "function") { - b = this.onBeforeCreate() - } else { - for (var d = 0; d < this.onBeforeCreate.length; ++d) { (this.onBeforeCreate[d].bind(this))() - } - } - } - this.noData = $WH.ce("div"); - this.noData.className = "listview-nodata text"; - if (this.mode == Listview.MODE_DIV) { - this.mainContainer = this.mainDiv = $WH.ce("div"); - this.mainContainer.className = "listview-mode-div" - } else { - this.mainContainer = this.table = $WH.ce("table"); - this.thead = $WH.ce("thead"); - this.tbody = $WH.ce("tbody"); - if (this.clickable) { - this.tbody.className = "clickable" - } - if (this.mode == Listview.MODE_TILED) { - if(!this.noStyle) - this.table.className = 'listview-mode-' + (this.mode == Listview.MODE_TILED ? 'tiled' : 'calendar'); - - var - e = (100 / this.nItemsPerRow) + "%", - f = $WH.ce("colgroup"), - c; - - for (var d = 0; d < this.nItemsPerRow; ++d) { - c = $WH.ce("col"); - c.style.width = e; - $WH.ae(f, c) - } - - $WH.ae(this.mainContainer, f) - } else { - this.table.className = "listview-mode-default"; - this.createHeader(); - this.updateSortArrow() - } - $WH.ae(this.table, this.thead); - $WH.ae(this.table, this.tbody); - if (this.mode == Listview.MODE_CHECKBOX && $WH.Browser.ie) { - setTimeout(Listview.cbIeFix.bind(this), 1) - } - } - this.createBands(); - if (this.customFilter != null) { - this.updateFilters() - } - this.updateNav(); - this.refreshRows(); - if (this.onAfterCreate != null) { - this.onAfterCreate(b) - } - }, - createHeader: function() { - var h = $WH.ce("tr"); - if (this.mode == Listview.MODE_CHECKBOX) { - var g = $WH.ce("th"), - j = $WH.ce("div"), - c = $WH.ce("a"); - g.style.width = "33px"; - c.href = "javascript:;"; - c.className = "listview-cb"; - $WH.ns(c); - $WH.ae(c, $WH.ct(String.fromCharCode(160))); - $WH.ae(j, c); - $WH.ae(g, j); - $WH.ae(h, g) - } - for (var f = 0, b = this.visibility.length; f < b; ++f) { - var e = this.visibility[f], - d = this.columns[e], - g = $WH.ce("th"); - j = $WH.ce("div"), - c = $WH.ce("a"), - outerSpan = $WH.ce("span"), - innerSpan = $WH.ce("span"); - d.__th = g; - c.href = "javascript:;"; - if (this.filtrable && (d.filtrable == null || d.filtrable)) { - c.onmouseup = Listview.headerClick.bind(this, d, e); - c.onclick = c.oncontextmenu = $WH.rf - } else { - c.onclick = this.sortBy.bind(this, e + 1) - } - c.onmouseover = Listview.headerOver.bind(this, c, d); - c.onmouseout = Tooltip.hide; - $WH.ns(c); - if (d.width != null) { - g.style.width = d.width - } - if (d.align != null) { - g.style.textAlign = d.align - } - if (d.span != null) { - g.colSpan = d.span - } - $WH.ae(innerSpan, $WH.ct(d.name)); - $WH.ae(outerSpan, innerSpan); - $WH.ae(c, outerSpan); - $WH.ae(j, c); - $WH.ae(g, j); - $WH.ae(h, g) - } - if (this.hideHeader) { - this.thead.style.display = "none" - } - $WH.ae(this.thead, h) - }, - createBands: function() { - var j = $WH.ce("div"), - l = $WH.ce("div"), - m = $WH.ce("div"), - k = $WH.ce("div"); - this.bandTop = j; - this.bandBot = l; - this.noteTop = m; - this.noteBot = k; - j.className = "listview-band-top"; - l.className = "listview-band-bottom"; - this.navTop = this.createNav(true); - this.navBot = this.createNav(false); - m.className = k.className = "listview-note"; - if (this.note) { - m.innerHTML = this.note; - var e = $WH.g_getGets(); - if (this.note.indexOf("fi_toggle()") > -1 && !e.filter) { - fi_toggle() - } - } else { - if (this.createNote) { - this.createNote(m, k) - } - } - if (this.debug && this.id != "topics") { - $WH.ae(m, $WH.ct(" (")); - var b = $WH.ce("a"); - b.onclick = this.getList.bind(this); - $WH.ae(b, $WH.ct("CSV")); - $WH.ae(m, b); - $WH.ae(m, $WH.ct(")")) - } - - if (this._errors) { - var - sp = $WH.ce('small'), - b = $WH.ce('b'); - - b.className = 'q10 report-icon'; - if (m.innerHTML) { - b.style.marginLeft = '10px'; - } - - g_addTooltip(sp, LANG.lvnote_witherrors, 'q') - - $WH.st(b, LANG.error); - $WH.ae(sp, b); - $WH.ae(m, sp); - } - - if (!m.firstChild && this.mode != Listview.MODE_CHECKBOX) { - $WH.ae(m, $WH.ct(String.fromCharCode(160))) - } - if (this.mode != Listview.MODE_CHECKBOX) { - $WH.ae(k, $WH.ct(String.fromCharCode(160))) - } - $WH.ae(j, this.navTop); - if (this.searchable) { - var o = this.updateFilters.bind(this, true), - f = (this._truncated ? "search-within-results2": "search-within-results"), - d = $WH.ce("span"), - c = $WH.ce("em"), - i = $WH.ce("a"), - h = $WH.ce("input"); - d.className = "listview-quicksearch"; - $WH.ae(d, c); - i.href = "javascript:;"; - i.onclick = function() { - var a = this.nextSibling; - a.value = ""; - a.className = f; - o() - }; - i.style.display = "none"; - $WH.ae(i, $WH.ce("span")); - $WH.ae(d, i); - $WH.ns(i); - h.setAttribute("type", "text"); - h.className = f; - h.style.width = (this._truncated ? "19em": "15em"); - g_onAfterTyping(h, o, this.searchDelay); - h.onmouseover = function() { - if ($WH.trim(this.value) != "") { - this.className = "" - } - }; - h.onfocus = function() { - this.className = "" - }; - h.onblur = function() { - if ($WH.trim(this.value) == "") { - this.className = f; - this.value = "" - } - }; - h.onkeypress = this.submitSearch.bind(this); - if ($WH.Browser.ie) { - setTimeout(function() { - h.value = "" - }, - 1) - } - $WH.ae(d, h); - this.quickSearchBox = h; - this.quickSearchGlass = c; - this.quickSearchClear = i; - $WH.ae(j, d) - } - $WH.ae(j, m); - $WH.ae(l, this.navBot); - $WH.ae(l, k); - if (this.mode == Listview.MODE_CHECKBOX) { - if (this.note) { - m.style.paddingBottom = "5px" - } - this.cbBarTop = this.createCbBar(true); - this.cbBarBot = this.createCbBar(false); - $WH.ae(j, this.cbBarTop); - $WH.ae(l, this.cbBarBot); - if (!this.noteTop.firstChild && !this.cbBarTop.firstChild) { - this.noteTop.innerHTML = " " - } - if (!this.noteBot.firstChild && !this.cbBarBot.firstChild) { - this.noteBot.innerHTML = " " - } - if (this.noteTop.firstChild && this.cbBarTop.firstChild) { - this.noteTop.style.paddingBottom = "6px" - } - if (this.noteBot.firstChild && this.cbBarBot.firstChild) { - this.noteBot.style.paddingBottom = "6px" - } - } - if (this.hideBands & 1) { - j.style.display = "none" - } - if (this.hideBands & 2) { - l.style.display = "none" - } - $WH.ae(this.container, this.bandTop); - if (this.clip) { - var g = $WH.ce("div"); - g.className = "listview-clip"; - g.style.width = this.clip.w + "px"; - g.style.height = this.clip.h + "px"; - this.clipDiv = g; - $WH.ae(g, this.mainContainer); - $WH.ae(g, this.noData); - $WH.ae(this.container, g) - } else { - $WH.ae(this.container, this.mainContainer); - $WH.ae(this.container, this.noData) - } - $WH.ae(this.container, this.bandBot) - }, - createNav: function(g) { - var c = $WH.ce("div"), - d = $WH.ce("a"), - b = $WH.ce("a"), - a = $WH.ce("a"), - j = $WH.ce("a"), - i = $WH.ce("span"), - h = $WH.ce("b"), - f = $WH.ce("b"), - e = $WH.ce("b"); - c.className = "listview-nav"; - d.href = b.href = a.href = j.href = "javascript:;"; - $WH.ae(d, $WH.ct(String.fromCharCode(171) + LANG.lvpage_first)); - $WH.ae(b, $WH.ct(String.fromCharCode(8249) + LANG.lvpage_previous)); - $WH.ae(a, $WH.ct(LANG.lvpage_next + String.fromCharCode(8250))); - $WH.ae(j, $WH.ct(LANG.lvpage_last + String.fromCharCode(187))); - $WH.ns(d); - $WH.ns(b); - $WH.ns(a); - $WH.ns(j); - d.onclick = this.firstPage.bind(this); - b.onclick = this.previousPage.bind(this); - a.onclick = this.nextPage.bind(this); - j.onclick = this.lastPage.bind(this); - - if (this.mode == Listview.MODE_CALENDAR) { - $WH.ae(h, $WH.ct('a')); - $WH.ae(i, h); - } - else { - $WH.ae(h, $WH.ct("a")); - $WH.ae(f, $WH.ct("a")); - $WH.ae(e, $WH.ct("a")); - $WH.ae(i, h); - $WH.ae(i, $WH.ct(LANG.hyphen)); - $WH.ae(i, f); - $WH.ae(i, $WH.ct(LANG.lvpage_of)); - $WH.ae(i, e); + initialize: function() { + if (this.data.length) { + if (this.computeDataFunc != null) { + for (var i = 0, len = this.data.length; i < len; ++i) { + this.computeDataFunc(this.data[i]); + } + } } - $WH.ae(c, d); - $WH.ae(c, b); - $WH.ae(c, i); - $WH.ae(c, a); - $WH.ae(c, j); - if (g) { - if (this.hideNav & 1) { - c.style.display = "none" - } - } else { - if (this.hideNav & 2) { - c.style.display = "none" - } - } - return c - }, - createCbBar: function(a) { - var b = $WH.ce("div"); - if (this.createCbControls) { - this.createCbControls(b, a) - } - if (b.firstChild) { - b.className = "listview-withselected" + (a ? "": "2") - } - return b - }, - refreshRows: function() { - var a = (this.mode == Listview.MODE_DIV ? this.mainContainer: this.tbody); - $WH.ee(a); - if (this.nRowsVisible == 0) { - if (!this.filtered) { - this.bandTop.style.display = this.bandBot.style.display = "none"; - this.mainContainer.style.display = "none" - } - this.noData.style.display = ""; - this.showNoData(); - return - } - var o, b, c; - if (! (this.hideBands & 1)) { - this.bandTop.style.display = "" - } - if (! (this.hideBands & 2)) { - this.bandBot.style.display = "" - } - if (this.nItemsPerPage > 0) { - o = this.rowOffset; - b = Math.min(o + this.nRowsVisible, o + this.nItemsPerPage); - if (this.filtered && this.rowOffset > 0) { - for (var f = 0, g = 0; f < this.data.length && g < this.rowOffset; ++f) { - var p = this.data[f]; - if (p.__hidden || p.__deleted) {++o - } else {++g - } - } - b += (o - this.rowOffset) - } - } else { - o = 0; - b = this.nRowsVisible - } - var h = b - o; - if (this.mode == Listview.MODE_DIV) { - for (var e = 0; e < h; ++e) { - var f = o + e, - p = this.data[f]; - if (!p) { - break - } - if (p.__hidden || p.__deleted) {++h; - continue - } - $WH.ae(this.mainDiv, this.getDiv(f)) - } - } else { - if (this.mode == Listview.MODE_TILED) { - var d = 0, - l = $WH.ce("tr"); - for (var e = 0; e < h; ++e) { - var f = o + e, - p = this.data[f]; - if (!p) { - break - } - if (p.__hidden || p.__deleted) {++h; - continue - } - $WH.ae(l, this.getCell(f)); - if (++d == this.nItemsPerRow) { - $WH.ae(this.tbody, l); - if (e + 1 < h) { - l = $WH.ce("tr") - } - d = 0 - } - } - if (d != 0) { - for (; d < 4; ++d) { - var m = $WH.ce("td"); - m.className = "empty-cell"; - $WH.ae(l, m) - } - $WH.ae(this.tbody, l) - } - } - else if (this.mode == Listview.MODE_CALENDAR) { - var tr = $WH.ce('tr'); + if (this.tabs) { + this.pounded = (this.tabs.poundedTab == this.tabIndex); + if (this.pounded) { + this.readPound(); + } + } + else { + this.readPound(); + } - for(var i = 0; i < 7; ++i) { - var th = $WH.ce('th'); - $WH.st(th, LANG.date_days[i]); - $WH.ae(tr, th); + this.applySort(); + + var obcResult; + if (this.onBeforeCreate != null) { + if (typeof this.onBeforeCreate == 'function') { + obcResult = this.onBeforeCreate(); + } + else { + for (var i = 0; i < this.onBeforeCreate.length; ++i) { + (this.onBeforeCreate[i].bind(this))(); + } + } + } + + this.noData = $WH.ce('div'); + this.noData.className = 'listview-nodata text'; + + if (this.mode == Listview.MODE_DIV) { + this.mainContainer = this.mainDiv = $WH.ce('div'); + if(!this.noStyle) { + this.mainContainer.className = 'listview-mode-div'; + } + } + else { + this.mainContainer = this.table = $WH.ce('table'); + this.thead = $WH.ce('thead'); + this.tbody = $WH.ce('tbody'); + + if (this.clickable) { + this.tbody.className = 'clickable'; + } + + if (this.mode == Listview.MODE_TILED || this.mode == Listview.MODE_CALENDAR) { + if(!this.noStyle) + this.table.className = 'listview-mode-' + (this.mode == Listview.MODE_TILED ? 'tiled' : 'calendar'); + + var + width = (100 / this.nItemsPerRow) + '%', + colGroup = $WH.ce('colgroup'), + col; + + for (var i = 0; i < this.nItemsPerRow; ++i) { + col = $WH.ce('col'); + col.style.width = width; + $WH.ae(colGroup, col); } - $WH.ae(this.tbody, tr); + $WH.ae(this.mainContainer, colGroup); + } + else { + if (!this.noStyle) { + this.table.className = 'listview-mode-default'; + } + + this.createHeader(); + this.updateSortArrow(); + } + + $WH.ae(this.table, this.thead); + $WH.ae(this.table, this.tbody); + } + + this.createBands(); + + if (this.customFilter != null) { + this.updateFilters(); + } + + this.updateNav(); + this.refreshRows(); + + if (this.onAfterCreate != null) { + this.onAfterCreate(obcResult); + } + }, + + createHeader: function() { + var tr = $WH.ce('tr'); + + if (this.mode == Listview.MODE_CHECKBOX) { + var + th = $WH.ce('th'), + div = $WH.ce('div'), + a = $WH.ce('a'); + + th.style.width = '33px'; + + a.href = 'javascript:;'; + a.className = 'listview-cb'; + $WH.ns(a); + $WH.ae(a, $WH.ct(String.fromCharCode(160))); + + $WH.ae(div, a); + $WH.ae(th, div); + $WH.ae(tr, th); + } + + for (var i = 0, len = this.visibility.length; i < len; ++i) { + var + reali = this.visibility[i], + col = this.columns[reali], + th = $WH.ce('th'); + + div = $WH.ce('div'), + a = $WH.ce('a'), + outerSpan = $WH.ce('span'), + innerSpan = $WH.ce('span'); + + col.__th = th; + + if (this.filtrable && (col.filtrable == null || col.filtrable)) { + a.onmouseup = Listview.headerClick.bind(this, col, reali); + a.onclick = a.oncontextmenu = $WH.rf; + } + else if (this.sortable) { + a.href = 'javascript:;'; + a.onclick = this.sortBy.bind(this, reali + 1); + } + + if (a.onclick) { + a.onmouseover = Listview.headerOver.bind(this, a, col); + a.onmouseout = $WH.Tooltip.hide; + $WH.ns(a); + } + else { + a.className = 'static'; + } + + if (col.width != null) { + th.style.width = col.width; + } + + if (col.align != null) { + th.style.textAlign = col.align; + } + + if (col.span != null) { + th.colSpan = col.span; + } + + $WH.ae(innerSpan, $WH.ct(col.name)); + $WH.ae(outerSpan, innerSpan); + + $WH.ae(a, outerSpan); + $WH.ae(div, a); + $WH.ae(th, div); + + $WH.ae(tr, th); + } + + if (this.hideHeader) { + this.thead.style.display = 'none'; + } + + $WH.ae(this.thead, tr); + }, + + createBands: function() { + var + bandTop = $WH.ce('div'), + bandBot = $WH.ce('div'), + noteTop = $WH.ce('div'), + noteBot = $WH.ce('div'); + + this.bandTop = bandTop; + this.bandBot = bandBot; + this.noteTop = noteTop; + this.noteBot = noteBot; + + bandTop.className = 'listview-band-top'; + bandBot.className = 'listview-band-bottom'; + + this.navTop = this.createNav(true); + this.navBot = this.createNav(false); + + noteTop.className = noteBot.className = 'listview-note'; + + if (this.note) { + noteTop.innerHTML = this.note; + var e = $WH.g_getGets(); + if (this.note.indexOf('fi_toggle()') > -1 && !e.filter) { + fi_toggle(); + } + } + else if (this.createNote) { + this.createNote(noteTop, noteBot); + } + + if (this.debug) { + $WH.ae(noteTop, $WH.ct(" (")); + var ids = $WH.ce('a'); + ids.onclick = this.getList.bind(this); + $WH.ae(ids, $WH.ct("CSV")); + $WH.ae(noteTop, ids); + $WH.ae(noteTop, $WH.ct(")")); + } + + if (this._errors) { + var + sp = $WH.ce('small'), + b = $WH.ce('b'); + + b.className = 'q10 report-icon'; + if (noteTop.innerHTML) { + b.style.marginLeft = '10px'; + } + + g_addTooltip(sp, LANG.lvnote_witherrors, 'q'); + + $WH.st(b, LANG.error); + $WH.ae(sp, b); + $WH.ae(noteTop, sp); + } + + if (!noteTop.firstChild && !(this.createCbControls || this.mode == Listview.MODE_CHECKBOX)) { + $WH.ae(noteTop, $WH.ct(String.fromCharCode(160))); + } + if (!(this.createCbControls || this.mode == Listview.MODE_CHECKBOX)) { + $WH.ae(noteBot, $WH.ct(String.fromCharCode(160))); + } + + $WH.ae(bandTop, this.navTop); + if (this.searchable) { + var + FI_FUNC = this.updateFilters.bind(this, true), + FI_CLASS = (this._truncated ? 'search-within-results2' : 'search-within-results'), + sp = $WH.ce('span'), + em = $WH.ce('em'), + a = $WH.ce('a'), + input = $WH.ce('input'); + + sp.className = 'listview-quicksearch'; + + if (this.tabClick) { + $(sp).click(this.tabClick); + } + + $WH.ae(sp, em); + + a.href = 'javascript:;'; + a.onclick = function() { + var foo = this.nextSibling; + foo.value = ''; + foo.className = FI_CLASS; + FI_FUNC(); + }; + a.style.display = 'none'; + $WH.ae(a, $WH.ce('span')); + $WH.ae(sp, a); + $WH.ns(a); + + input.setAttribute('type', 'text'); + input.className = FI_CLASS; + input.style.width = (this._truncated ? '19em': '15em'); + g_onAfterTyping(input, FI_FUNC, this.searchDelay); + + input.onmouseover = function() { + if ($WH.trim(this.value) != '') { + this.className = ''; + } + }; + + input.onfocus = function() { + this.className = ''; + }; + + input.onblur = function() { + if ($WH.trim(this.value) == '') { + this.className = FI_CLASS; + this.value = ''; + } + }; + + input.onkeypress = this.submitSearch.bind(this); + + $WH.ae(sp, input); + + this.quickSearchBox = input; + this.quickSearchGlass = em; + this.quickSearchClear = a; + + $WH.ae(bandTop, sp); + } + $WH.ae(bandTop, noteTop); + + $WH.ae(bandBot, this.navBot); + $WH.ae(bandBot, noteBot); + + if (this.createCbControls || this.mode == Listview.MODE_CHECKBOX) { + if (this.note) { + noteTop.style.paddingBottom = '5px'; + } + + this.cbBarTop = this.createCbBar(true); + this.cbBarBot = this.createCbBar(false); + + $WH.ae(bandTop, this.cbBarTop); + $WH.ae(bandBot, this.cbBarBot); + + if (!this.noteTop.firstChild && !this.cbBarTop.firstChild) { + this.noteTop.innerHTML = ' '; + } + + if (!this.noteBot.firstChild && !this.cbBarBot.firstChild) { + this.noteBot.innerHTML = ' '; + } + + if (this.noteTop.firstChild && this.cbBarTop.firstChild) { + this.noteTop.style.paddingBottom = '6px'; + } + + if (this.noteBot.firstChild && this.cbBarBot.firstChild) { + this.noteBot.style.paddingBottom = '6px'; + } + } + + if (this.hideBands & 1) { + bandTop.style.display = 'none'; + } + if (this.hideBands & 2) { + bandBot.style.display = 'none'; + } + + $WH.ae(this.container, this.bandTop); + if (this.clip) { + var clipDiv = $WH.ce('div'); + clipDiv.className = 'listview-clip'; + clipDiv.style.width = this.clip.w + 'px'; + clipDiv.style.height = this.clip.h + 'px'; + this.clipDiv = clipDiv; + + $WH.ae(clipDiv, this.mainContainer); + $WH.ae(clipDiv, this.noData); + $WH.ae(this.container, clipDiv); + } + else { + $WH.ae(this.container, this.mainContainer); + $WH.ae(this.container, this.noData); + } + $WH.ae(this.container, this.bandBot); + }, + + createNav: function(top) { + var + div = $WH.ce('div'), + a1 = $WH.ce('a'), + a2 = $WH.ce('a'), + a3 = $WH.ce('a'), + a4 = $WH.ce('a'), + span = $WH.ce('span'), + b1 = $WH.ce('b'), + b2 = $WH.ce('b'), + b3 = $WH.ce('b'); + + div.className = 'listview-nav'; + + a1.href = a2.href = a3.href = a4.href = 'javascript:;'; + + $WH.ae(a1, $WH.ct(String.fromCharCode(171) + LANG.lvpage_first)); + $WH.ae(a2, $WH.ct(String.fromCharCode(8249) + LANG.lvpage_previous)); + $WH.ae(a3, $WH.ct(LANG.lvpage_next + String.fromCharCode(8250))); + $WH.ae(a4, $WH.ct(LANG.lvpage_last + String.fromCharCode(187))); + + $WH.ns(a1); + $WH.ns(a2); + $WH.ns(a3); + $WH.ns(a4); + + a1.onclick = this.firstPage.bind(this); + a2.onclick = this.previousPage.bind(this); + a3.onclick = this.nextPage.bind(this); + a4.onclick = this.lastPage.bind(this); + + if (this.mode == Listview.MODE_CALENDAR) { + $WH.ae(b1, $WH.ct('a')); + $WH.ae(span, b1); + } + else { + $WH.ae(b1, $WH.ct('a')); + $WH.ae(b2, $WH.ct('a')); + $WH.ae(b3, $WH.ct('a')); + $WH.ae(span, b1); + $WH.ae(span, $WH.ct(LANG.hyphen)); + $WH.ae(span, b2); + $WH.ae(span, $WH.ct(LANG.lvpage_of)); + $WH.ae(span, b3); + } + + $WH.ae(div, a1); + $WH.ae(div, a2); + $WH.ae(div, span); + $WH.ae(div, a3); + $WH.ae(div, a4); + + if (top) { + if (this.hideNav & 1) { + div.style.display = 'none'; + } + } + else { + if (this.hideNav & 2) { + div.style.display = 'none'; + } + } + + if (this.tabClick) { + $('a', div).click(this.tabClick); + } + + return div; + }, + + createCbBar: function(topBar) { + var div = $WH.ce('div'); + + if (this.createCbControls) { + this.createCbControls(div, topBar); + } + + if(div.firstChild) { // Not empty + div.className = 'listview-withselected' + (topBar ? '' : '2'); + } + + return div; + }, + + refreshRows: function() { + var target = (this.mode == Listview.MODE_DIV ? this.mainContainer: this.tbody); + $WH.ee(target); + + if (this.nRowsVisible == 0) { + if (!this.filtered) { + this.bandTop.style.display = this.bandBot.style.display = 'none'; + + this.mainContainer.style.display = 'none'; + } + + this.noData.style.display = ''; + this.showNoData(); + + return; + } + + var + starti, + endi, + func; + + if (! (this.hideBands & 1)) { + this.bandTop.style.display = ''; + } + if (! (this.hideBands & 2)) { + this.bandBot.style.display = ''; + } + + if (this.nDaysPerMonth && this.nDaysPerMonth.length) { + starti = 0; + for(var i = 0; i < this.rowOffset; ++i) { + starti += this.nDaysPerMonth[i]; + } + endi = starti + this.nDaysPerMonth[i]; + } + else if (this.nItemsPerPage > 0) { + starti = this.rowOffset; + endi = Math.min(starti + this.nRowsVisible, starti + this.nItemsPerPage); + + if (this.filtered && this.rowOffset > 0) { // Adjusts start and end position when listview is filtered + for (var i = 0, count = 0; i < this.data.length && count < this.rowOffset; ++i) { + var row = this.data[i]; + + if (row.__hidden || row.__deleted) { + ++starti; + } + else { + ++count; + } + } + endi += (starti - this.rowOffset); + } + } + else { + starti = 0; + endi = this.nRowsVisible; + } + + var nItemsToDisplay = endi - starti; + + if (this.mode == Listview.MODE_DIV) { + for (var j = 0; j < nItemsToDisplay; ++j) { + var + i = starti + j, + row = this.data[i]; + + if (!row) { + break; + } + + if (row.__hidden || row.__deleted) { + ++nItemsToDisplay; + continue; + } + + $WH.ae(this.mainDiv, this.getDiv(i)); + } + } + else if (this.mode == Listview.MODE_TILED) { + var + k = 0, tr = $WH.ce('tr'); - for (var k = 0; k < this.dates[o].date.getDay(); ++k) { + for (var j = 0; j < nItemsToDisplay; ++j) { + var + i = starti + j, + row = this.data[i]; + + if (!row) { + break; + } + + if (row.__hidden || row.__deleted) { + ++nItemsToDisplay; + continue; + } + + $WH.ae(tr, this.getCell(i)); + + if (++k == this.nItemsPerRow) { + $WH.ae(this.tbody, tr); + if (j + 1 < nItemsToDisplay) { + tr = $WH.ce('tr'); + } + k = 0; + } + } + + if (k != 0) { + for (; k < 4; ++k) { var foo = $WH.ce('td'); foo.className = 'empty-cell'; $WH.ae(tr, foo); } + $WH.ae(this.tbody, tr); + } + } + else if (this.mode == Listview.MODE_CALENDAR) { + var tr = $WH.ce('tr'); - for (var j = o; j < b; ++j) { - $WH.ae(tr, this.getEvent(j)); + for(var i = 0; i < 7; ++i) { + var th = $WH.ce('th'); + $WH.st(th, LANG.date_days[i]); + $WH.ae(tr, th); + } - if(++k == 7) { - $WH.ae(this.tbody, tr); - tr = $WH.ce('tr'); - k = 0; + $WH.ae(this.tbody, tr); + tr = $WH.ce('tr'); + + for (var k = 0; k < this.dates[starti].date.getDay(); ++k) { + var foo = $WH.ce('td'); + foo.className = 'empty-cell'; + $WH.ae(tr, foo); + } + + for (var j = starti; j < endi; ++j) { + $WH.ae(tr, this.getEvent(j)); + + if (++k == 7) { + $WH.ae(this.tbody, tr); + tr = $WH.ce('tr'); + k = 0; + } + } + + if (k != 0) { + for(; k < 7; ++k) { + var foo = $WH.ce('td'); + foo.className = 'empty-cell'; + $WH.ae(tr, foo); + } + $WH.ae(this.tbody, tr); + } + } + else { // DEFAULT || CHECKBOX + for (var j = 0; j < nItemsToDisplay; ++j) { + var + i = starti + j, + row = this.data[i]; + + if (!row) { + break; + } + + if (row.__hidden || row.__deleted) { + ++nItemsToDisplay; + continue; + } + + $WH.ae(this.tbody, this.getRow(i)); + } + } + + this.mainContainer.style.display = ''; + this.noData.style.display = 'none'; + }, + + showNoData: function() { + var div = this.noData; + $WH.ee(div); + + var result = -1; + if (this.onNoData) { + result = (this.onNoData.bind(this, div))(); + } + + if (result == -1) { + $WH.ae(this.noData, $WH.ct(this.filtered ? LANG.lvnodata2: LANG.lvnodata)); + } + }, + + getDiv: function(i) { + var row = this.data[i]; + + if (row.__div == null || this.minPatchVersion != row.__minPatch) { + this.createDiv(row, i); + } + + return row.__div; + }, + + createDiv: function(row, i) { + var div = $WH.ce('div'); + row.__div = div; + if (this.minPatchVersion) { + row.__minPatch = this.minPatchVersion; + } + + (this.template.compute.bind(this, row, div, i))(); + }, + + getCell: function(i) { + var row = this.data[i]; + + if (row.__td == null) { + this.createCell(row, i); + } + + return row.__td; + }, + + createCell: function(row, i) { + var td = $WH.ce('td'); + row.__td = td; + + (this.template.compute.bind(this, row, td, i))(); + }, + + getEvent: function(i) { + var row = this.dates[i]; + + if (row.__td == null) { + this.createEvent(row, i); + } + + return row.__td; + }, + + createEvent: function(row, i) { + row.events = $WH.array_filter(this.data, function(holiday) { + if (holiday.__hidden || holiday.__deleted) { + return false; + } + + var dates = Listview.funcBox.getEventNextDates(holiday.startDate, holiday.endDate, holiday.rec || 0, row.date); + if (dates[0] && dates[1]) { + dates[0].setHours(0, 0, 0, 0); + dates[1].setHours(0, 0, 0, 0); + return dates[0] <= row.date && dates[1] >= row.date; + } + + return false; + }); + + var td = $WH.ce('td'); + row.__td = td; + + if (row.date.getFullYear() == g_serverTime.getFullYear() && row.date.getMonth() == g_serverTime.getMonth() && row.date.getDate() == g_serverTime.getDate()) { + td.className = 'calendar-today'; + } + + var div = $WH.ce('div'); + div.className = 'calendar-date'; + $WH.st(div, row.date.getDate()); + $WH.ae(td, div); + + div = $WH.ce('div'); + div.className = 'calendar-event'; + $WH.ae(td, div); + + (this.template.compute.bind(this, row, div, i))(); + + if (this.getItemLink) { + td.onclick = this.itemClick.bind(this, row); + } + }, + + getRow: function(i) { + var row = this.data[i]; + + if (row.__tr == null) { + this.createRow(row); + } + + return row.__tr; + }, + + setRow: function(newRow) { + if (this.data[newRow.pos]) { + this.data[newRow.pos] = newRow; + this.data[newRow.pos].__tr = newRow.__tr; + this.createRow(this.data[newRow.pos]); + this.refreshRows(); + } + }, + + createRow: function(row) { + var tr = $WH.ce('tr'); + row.__tr = tr; + + if (this.mode == Listview.MODE_CHECKBOX) { + var td = $WH.ce('td'); + + if (!row.__nochk) { + td.className = 'listview-cb'; + td.onclick = Listview.cbCellClick; + + var cb = $WH.ce('input'); + $WH.ns(cb); + cb.type = 'checkbox'; + cb.onclick = Listview.cbClick; + + if (row.__chk) { + cb.checked = true; + } + + row.__cb = cb; + + $WH.ae(td, cb); + } + + $WH.ae(tr, td); + } + + for (var i = 0, len = this.visibility.length; i < len; ++i) { + var + reali = this.visibility[i], + col = this.columns[reali], + td = $WH.ce('td'), + result; + + if (col.align != null) { + td.style.textAlign = col.align; + } + + if (col.compute) { + result = (col.compute.bind(this, row, td, tr, reali))(); + } + else { + if (row[col.value] != null) { + result = row[col.value]; + } + else { + result = -1; + } + } + + if (result != -1 && result != null) { + td.insertBefore($WH.ct(result), td.firstChild); + } + + $WH.ae(tr, td); + } + + if (this.mode == Listview.MODE_CHECKBOX && row.__chk) { + tr.className = 'checked'; + } + + if (row.frommerge == 1) { + tr.className += ' mergerow'; + } + + if (this.getItemLink) { + tr.onclick = this.itemClick.bind(this, row); + } + }, + + itemClick: function(row, e) { + e = $WH.$E(e); + + var + i = 0, + el = e._target; + + while (el && i < 3) { + if (el.nodeName == 'A') { + return; + } + el = el.parentNode; + } + + location.href = this.getItemLink(row); + }, + + submitSearch: function(e) { + e = $WH.$E(e); + + if (!this.onSearchSubmit || e.keyCode != 13) { + return; + } + + for (var i = 0, len = this.data.length; i < len; ++i) { + if (this.data[i].__hidden) { + continue; + } + + (this.onSearchSubmit.bind(this, this.data[i]))(); + } + }, + + validatePage: function() { + var + rpp = this.nItemsPerPage, + ro = this.rowOffset, + len = this.nRowsVisible; + + if (ro < 0) { + this.rowOffset = 0; + } + else if (this.mode == Listview.MODE_CALENDAR) { + this.rowOffset = Math.min(ro, this.nDaysPerMonth.length - 1); + } + else { + this.rowOffset = this.getRowOffset(ro + rpp > len ? len - 1 : ro); + } + }, + + getRowOffset: function(rowNo) { + var rpp = this.nItemsPerPage; + + return (rpp > 0 && rowNo > 0 ? Math.floor(rowNo / rpp) * rpp: 0); + }, + + resetRowVisibility: function() { + for (var i = 0, len = this.data.length; i < len; ++i) { + this.data[i].__hidden = false; + } + + this.filtered = false; + this.rowOffset = 0; + this.nRowsVisible = this.data.length; + }, + + getColText: function(row, col) { + var text = ''; + if (this.template.getVisibleText) { + text = $WH.trim(this.template.getVisibleText(row) + ' '); + } + + if (col.getVisibleText) { + return text + col.getVisibleText(row) + } + + if (col.getValue) { + return text + col.getValue(row) + } + + if (col.value) { + return text + row[col.value] + } + + if (col.compute) { + return text + col.compute(row, $WH.ce('td'), $WH.ce('tr')); + } + + return "" + }, + + resetFilters: function() { + for (var j = 0, len2 = this.visibility.length; j < len2; ++j) { + var realj = this.visibility[j]; + var col = this.columns[realj]; + + if (col.__filter) { + col.__th.firstChild.firstChild.className = ''; + col.__filter = null; + --(this.nFilters); + } + } + }, + + updateFilters: function(refresh) { + $WH.Tooltip.hide(); + this.resetRowVisibility(); + + var + searchText, + parts, + nParts; + + if (this.searchable) { + this.quickSearchBox.parentNode.style.display = ''; + + searchText = $WH.trim(this.quickSearchBox.value); + + if (searchText) { + this.quickSearchGlass.style.display = 'none'; + this.quickSearchClear.style.display = ''; + + searchText = searchText.toLowerCase().replace(/\s+/g, ' '); + + parts = searchText.split(' '); + nParts = parts.length; + } + else { + this.quickSearchGlass.style.display = ''; + this.quickSearchClear.style.display = 'none'; + } + } + else if (this.quickSearchBox) { + this.quickSearchBox.parentNode.style.display = 'none'; + } + + if (!searchText && this.nFilters == 0 && this.customFilter == null) { + if (refresh) { + this.updateNav(); + this.refreshRows(); + } + + return; + } + + // Numerical + var filterFuncs = { + 1: function(x, y) { + return x > y; + }, + 2: function(x, y) { + return x == y; + }, + 3: function(x, y) { + return x < y; + }, + 4: function(x, y) { + return x >= y; + }, + 5: function(x, y) { + return x <= y; + }, + 6: function(x, y, z) { + return y <= x && x <= z; + } + }; + + // Range + var filterFuncs2 = { + 1: function(min, max, y) { + return max > y; + }, + 2: function(min, max, y) { + return min <= y && y <= max; + }, + 3: function(min, max, y) { + return min < y; + }, + 4: function(min, max, y) { + return max >= y; + }, + 5: function(min, max, y) { + return min <= y; + }, + 6: function(min, max, y, z) { + return y <= max && min <= z; + } + }; + + var nRowsVisible = 0; + + for (var i = 0, len = this.data.length; i < len; ++i) { + var + row = this.data[i], + nFilterMatches = 0, + nSearchMatches = 0, + matches = []; + + row.__hidden = true; + + if (this.customFilter && !this.customFilter(row, i)) { + continue; + } + + for (var j = 0, len2 = this.visibility.length; j < len2; ++j) { + var realj = this.visibility[j]; + var col = this.columns[realj]; + + if (col.__filter) { + var + filter = col.__filter, + result = false; + + if (col.type != null && col.type == 'range') { + var + minValue = col.getMinValue(row), + maxValue = col.getMaxValue(row); + + result = (filterFuncs2[filter.type])(minValue, maxValue, filter.value, filter.value2); + } + else if (col.type == null || col.type == 'num' || filter.type > 0) { + var value = null; + + if (col.getValue) { + value = col.getValue(row); + } + else if (col.value) { + value = parseFloat(row[col.value]); + } + + if (!value) { + value = 0; + } + + result = (filterFuncs[filter.type])(value, filter.value, filter.value2); + } + else { + var text = this.getColText(row, col); + + if (text) { + text = text.toString().toLowerCase(); + + if (filter.invert) { + result = text.match(filter.regex) != null; + } + else { + var foo = 0; + + for (var k = 0, len3 = filter.words.length; k < len3; ++k) { + if (text.indexOf(filter.words[k]) != -1) { + ++foo; + } + else { + break; + } + } + + result = (foo == filter.words.length); + } + } + } + + if (filter.invert) { + result = !result; + } + + if (result) { + ++nFilterMatches; + } + else { + break; } } - if (k != 0) { - for(; k < 7; ++k) { - var foo = $WH.ce('td'); - foo.className = 'empty-cell'; - $WH.ae(tr, foo); + if (searchText) { + var text = this.getColText(row, col); + if (text) { + text = text.toString().toLowerCase(); + + for (var k = 0, len3 = parts.length; k < len3; ++k) { + if (!matches[k]) { + if (text.indexOf(parts[k]) != -1) { + matches[k] = 1; + ++nSearchMatches; + } + } + } + } + } + } + + if (row.__alwaysvisible || + ((this.nFilters == 0 || nFilterMatches == this.nFilters) && + (!searchText || nSearchMatches == nParts))) { + row.__hidden = false; + ++nRowsVisible; + } + } + + this.filtered = (nRowsVisible < this.data.length); + this.nRowsVisible = nRowsVisible; + + if (refresh) { + this.updateNav(); + this.refreshRows(); + } + }, + + changePage: function() { + this.validatePage(); + + this.refreshRows(); + this.updateNav(); + this.updatePound(); + + var + scroll = $WH.g_getScroll(), + c = $WH.ac(this.container); + + if (scroll.y > c[1]) { + scrollTo(scroll.x, c[1]); + } + }, + + firstPage: function() { + this.rowOffset = 0; + this.changePage(); + + return false; + }, + + previousPage: function() { + this.rowOffset -= this.nItemsPerPage; + this.changePage(); + + return false; + }, + + nextPage: function() { + this.rowOffset += this.nItemsPerPage; + this.changePage(); + + return false; + }, + + lastPage: function() { + this.rowOffset = 99999999; + this.changePage(); + + return false; + }, + + addSort: function(arr, colNo) { + var i = $WH.in_array(arr, Math.abs(colNo), function(x) { + return Math.abs(x); + }); + + if (i != -1) { + colNo = arr[i]; + arr.splice(i, 1); + } + + arr.splice(0, 0, colNo); + }, + + sortBy: function(colNo) { + if (colNo <= 0 || colNo > this.columns.length) { + return; + } + + if (Math.abs(this.sort[0]) == colNo) { + this.sort[0] = -this.sort[0]; + } + else { + var defaultSort = -1; + if (this.columns[colNo-1].type == 'text') { + defaultSort = 1; + } + + this.addSort(this.sort, defaultSort * colNo); + } + + this.applySort(); + this.refreshRows(); + this.updateSortArrow(); + this.updatePound(); + }, + + applySort: function() { + if (this.sort.length == 0) { + return; + } + + Listview.sort = this.sort; + Listview.columns = this.columns; + + if (this.indexCreated) { + this.data.sort(Listview.sortIndexedRows.bind(this)); + } + else { + this.data.sort(Listview.sortRows.bind(this)); + } + + this.updateSortIndex(); + }, + + setSort: function(sort, refresh, updatePound) { + if (this.sort.toString() != sort.toString()) { + this.sort = sort; + this.applySort(); + + if (refresh) { + this.refreshRows(); + } + + if (updatePound) { + this.updatePound(); + } + } + }, + + readPound: function() { + if (!this.poundable || !location.hash.length) { + return false; + } + + var _ = location.hash.substr(1); + if (this.tabs) { + var n = _.lastIndexOf(':'); + + if (n == -1) { + return false; + } + + _ = _.substr(n + 1); + } + + var num = parseInt(_); + if (!isNaN(num)) { + this.rowOffset = num; + this.validatePage(); + + if (this.poundable != 2) { + var sort = []; + var matches= _.match(/(\+|\-)[0-9]+/g); + if (matches != null) { + for (var i = matches.length - 1; i >= 0; --i) { + var colNo = parseInt(matches[i]) | 0; + var _ = Math.abs(colNo); + if (_ <= 0 || _ > this.columns.length) { + break; + } + this.addSort(sort, colNo); + } + + this.setSort(sort, false, false); + } + } + + if (this.tabs) { + this.tabs.setTabPound(this.tabIndex, this.getTabPound()); + } + } + }, + + updateSortArrow: function() { + if (!this.sort.length || !this.thead || this.mode == Listview.MODE_TILED || this.mode == Listview.MODE_CALENDAR) { + return; + } + + var i = $WH.in_array(this.visibility, Math.abs(this.sort[0]) - 1); + + if (i == -1) { + return; + } + + if (this.mode == Listview.MODE_CHECKBOX && i < this.thead.firstChild.childNodes.length - 1) { + i += 1; + } + + var span = this.thead.firstChild.childNodes[i].firstChild.firstChild.firstChild; + + if (this.lsa && this.lsa != span) { // lastSortArrow + this.lsa.className = ''; + } + + span.className = (this.sort[0] < 0 ? 'sortdesc': 'sortasc'); + this.lsa = span; + }, + + updateSortIndex: function() { + var _ = this.data; + + for (var i = 0, len = _.length; i < len; ++i) { + _[i].__si = i; // sortIndex + } + + this.indexCreated = true; + }, + + updateTabName: function() { + if (this.tabs && this.tabIndex != null) { + this.tabs.setTabName(this.tabIndex, this.getTabName()); + } + }, + + updatePound: function(useCurrentSort) { + if (!this.poundable) { + return; + } + + var + _ = '', + id = ''; + + if (useCurrentSort) { + if (location.hash.length && this.tabs) { + var n = location.hash.lastIndexOf(':'); + if (n != -1 && !isNaN(parseInt(location.hash.substr(n + 1)))) { + _ = location.hash.substr(n + 1); + } + } + } + else { + _ = this.getTabPound(); + } + + if (this.customPound) { + id = this.customPound; + } + else if (this.tabs) { + id = this.id; + } + + if (_ && this.tabs) { + this.tabs.setTabPound(this.tabIndex, _); + } + + location.replace('#' + id + (id && _ ? ':' : '') + _); + }, + + updateNav: function() { + var + arr = [this.navTop, this.navBot], + _ = this.nItemsPerPage, + __ = this.rowOffset, + ___ = this.nRowsVisible, + first = 0, + previous = 0, + next = 0, + last = 0, + date = new Date(); + + if (___ > 0) { + if (! (this.hideNav & 1)) { + arr[0].style.display = ''; + } + if (! (this.hideNav & 2)) { + arr[1].style.display = ''; + } + } + else { + arr[0].style.display = arr[1].style.display = 'none'; + } + + if (this.mode == Listview.MODE_CALENDAR) { + for (var i = 0; i < this.nDaysPerMonth.length; ++i) { + if (i == __) { // Selected month + if (i > 0) + previous = 1; + if (i > 1) + first = 1; + if (i < this.nDaysPerMonth.length - 1) + next = 1; + if (i < this.nDaysPerMonth.length - 2) + last = 1; + } + } + + date.setTime(this.startOnMonth.valueOf()); + date.setMonth(date.getMonth() + __); + } + else { + if (_) { + if (__ > 0) { + previous = 1; + if (__ >= _ + _) { + first = 1; + } + } + if (__ + _ < ___) { + next = 1; + if (__ + _ + _ < ___) { + last = 1; + } + } + } + } + + for (var i = 0; i < 2; ++i) { + var childs = arr[i].childNodes; + + childs[0].style.display = (first ? '': 'none'); + childs[1].style.display = (previous ? '': 'none'); + childs[3].style.display = (next ? '': 'none'); + childs[4].style.display = (last ? '': 'none'); + childs = childs[2].childNodes; + + if (this.mode == Listview.MODE_CALENDAR) { + childs[0].firstChild.nodeValue = LANG.date_months[date.getMonth()] + ' ' + date.getFullYear(); + } + else { + childs[0].firstChild.nodeValue = __ + 1; + childs[2].firstChild.nodeValue = _ ? Math.min(__ + _, ___) : ___; + childs[4].firstChild.nodeValue = ___; + } + } + }, + + getTabName: function() { + var + name = this.name, + n = this.data.length; + + for (var i = 0, len = this.data.length; i < len; ++i) { + if (this.data[i].__hidden || this.data[i].__deleted) { + --n; + } + } + + if (n > 0 && !this.hideCount) { + name += $WH.sprintf(LANG.qty, n); + } + + return name; + }, + + getTabPound: function() { + var buffer = ''; + + buffer += this.rowOffset; + + if (this.poundable != 2 && this.sort.length) { + buffer += ('+' + this.sort.join('+')).replace(/\+\-/g, '-'); + } + + return buffer; + }, + + getCheckedRows: function() { + var checkedRows = []; + + for (var i = 0, len = this.data.length; i < len; ++i) { + var _ = this.data[i]; + + if ((_.__cb && _.__cb.checked) || (!_.__cb && _.__chk)) { + checkedRows.push(_); + } + } + + return checkedRows; + }, + + resetCheckedRows: function() { + for (var i = 0, len = this.data.length; i < len; ++i) { + var _ = this.data[i]; + + if (_.__cb) { + _.__cb.checked = false; + } + else if (_.__chk) { + _.__chk = null; + } + + if (_.__tr) { + _.__tr.className = _.__tr.className.replace('checked', ''); + } + } + }, + + deleteRows: function(rows) { + if (!rows || !rows.length) { + return; + } + + for (var i = 0, len = rows.length; i < len; ++i) { + var row = rows[i]; + + if (!row.__hidden && !row.__hidden) { + this.nRowsVisible -= 1; + } + + row.__deleted = true; + } + + this.updateTabName(); + + if (this.rowOffset >= this.nRowsVisible) { + this.previousPage(); + } + else { + this.refreshRows(); + this.updateNav(); + } + }, + + setData: function(data) { + this.data = data; + this.indexCreated = false; + + this.resetCheckedRows(); + this.resetRowVisibility(); + + if (this.tabs) { + this.pounded = (this.tabs.poundedTab == this.tabIndex); + if (this.pounded) { + this.readPound(); + } + } + else { + this.readPound(); + } + + this.applySort(); + this.updateSortArrow(); + + if (this.customFilter != null) { + this.updateFilters(); + } + + this.updateNav(); + this.refreshRows(); + }, + + getClipDiv: function() { + return this.clipDiv; + }, + + getNoteTopDiv: function() { + return this.noteTop; + }, + + focusSearch: function() { + this.quickSearchBox.focus(); + }, + + clearSearch: function() { + this.quickSearchBox.value = ''; + }, + + getList: function() { + if (!this.debug) { + return; + } + var str = ''; + for (var i = 0; i < this.data.length; i++) { + if (!this.data[i].__hidden) { + str += this.data[i].id + ', '; + } + } + + listviewIdList.show(str); + }, + + createIndicator: function(v, f, c) { + if (!this.noteIndicators) { + this.noteIndicators = $WH.ce('div'); + this.noteIndicators.className = 'listview-indicators'; + $(this.noteIndicators).insertBefore($(this.noteTop)); + } + + var t = this.tabClick; + $(this.noteIndicators).append( + $('') + .html(v) + .append(!f ? '' : + $('[x]') + .attr('href', (typeof f == 'function' ? 'javascript:;' : f)) + .click(function () { if (t) t(); if (typeof f == 'function') f(); }) + ) + .css('cursor', (typeof c == 'function' ? 'pointer' : null)) + .click(function () { if (t) t(); if (typeof c == 'function') c(); }) + ); + + $(this.noteTop).css('padding-top', '7px'); + }, + + removeIndicators: function() { + if (this.noteIndicators) { + $(this.noteIndicators).remove(); + this.noteIndicators = null; + } + + $(this.noteTop).css('padding-top', ''); + } +}; + +Listview.sortRows = function(a, b) { + var + sort = Listview.sort, + cols = Listview.columns; + + for (var i = 0, len = sort.length; i < len; ++i) { + var + res, + _ = cols[Math.abs(sort[i]) - 1]; + + if (!_) { + _ = this.template; + } + + if (_.sortFunc) { + res = _.sortFunc(a, b, sort[i]); + } + else { + res = $WH.strcmp(a[_.value], b[_.value]); + } + + if (res != 0) { + return res * sort[i]; + } + } + + return 0; +}, + +Listview.sortIndexedRows = function(a, b) { + var + sort = Listview.sort, + cols = Listview.columns, + res; + + for (var idx in sort) { + _ = cols[Math.abs(sort[idx]) - 1]; + + if(!_) { + _ = this.template; + } + + if (_.sortFunc) { + res = _.sortFunc(a, b, sort[0]); + } + else { + res = $WH.strcmp(a[_.value], b[_.value]); + } + + if (res != 0) { + return res * sort[idx]; + } + } + + return (a.__si - b.__si); +}, + +Listview.cbSelect = function(v) { + for (var i = 0, len = this.data.length; i < len; ++i) { + var _ = this.data[i]; + var v2 = v; + + if (_.__hidden) { + continue; + } + + if (!_.__nochk && _.__cb) { + var + cb = _.__cb, + tr = cb.parentNode.parentNode; + + if (v2 == null) { + v2 = !cb.checked; + } + + if (cb.checked != v2) { + cb.checked = v2; + tr.className = (cb.checked ? tr.className + ' checked' : tr.className.replace('checked', '')); + } + } + else if (v2 == null) { + v2 = true; + } + + _.__chk = v2; + } +}; + +Listview.cbClick = function(e) { + setTimeout(Listview.cbUpdate.bind(0, 0, this, this.parentNode.parentNode), 1); + $WH.sp(e); +}; + +Listview.cbCellClick = function(e) { + setTimeout(Listview.cbUpdate.bind(0, 1, this.firstChild, this.parentNode), 1); + $WH.sp(e); +}; + +Listview.cbUpdate = function(toggle, cb, tr) { + if (toggle) { + cb.checked = !cb.checked; + } + + tr.className = (cb.checked ? tr.className + ' checked' : tr.className.replace('checked', '')); +}; + +Listview.headerClick = function(col, i, e) { + e = $WH.$E(e); + + if (this.tabClick) { + this.tabClick(); + } + + if (e._button == 3 || e.shiftKey || e.ctrlKey) { + $WH.Tooltip.hide(); + setTimeout(Listview.headerFilter.bind(this, col, null), 1); + } + else { + this.sortBy(i + 1); + } + + return false; +}; + +Listview.headerFilter = function(col, res) { + var prefilled = ''; + if (col.__filter) { + if (col.__filter.invert) { + prefilled += '!'; + } + + prefilled += col.__filter.text; + } + + if (res == null) { + var res = prompt($WH.sprintf(LANG.prompt_colfilter1 + (col.type == 'text' ? LANG.prompt_colfilter2: LANG.prompt_colfilter3), col.name), prefilled); + } + + if (res != null) { + var filter = {text: '', type: -1}; + + res = $WH.trim(res.replace(/\s+/g, ' ')); + + if (!res && this.onEmptyFilter) { + this.onEmptyFilter(col); + } + else if (res) { + if (res.charAt(0) == '!' || res.charAt(0) == '-') { + filter.invert = 1; + res = res.substr(1); + } + + if (col.type == 'text') { + filter.type = 0; + filter.text = res; + + if (filter.invert) { + filter.regex = g_createOrRegex(res); + } + else { + filter.words = res.toLowerCase().split(' '); + } + } + var + value, + value2; + + if (res.match(/(>|=|<|>=|<=)\s*([0-9\.]+)/)) { + value = parseFloat(RegExp.$2); + if (!isNaN(value)) { + switch (RegExp.$1) { + case '>': + filter.type = 1; + break; + case '=': + filter.type = 2; + break; + case '<': + filter.type = 3; + break; + case '>=': + filter.type = 4; + break; + case '<=': + filter.type = 5; + break; + } + filter.value = value; + filter.text = RegExp.$1 + ' ' + value; + } + } + else if (res.match(/([0-9\.]+)\s*\-\s*([0-9\.]+)/)) { + value = parseFloat(RegExp.$1); + value2 = parseFloat(RegExp.$2); + if (!isNaN(value) && !isNaN(value2)) { + if (value > value2) { + var foo = value; + value = value2; + value2 = foo; + } + + if (value == value2) { + filter.type = 2; + filter.value = value; + filter.text = '= ' + value; + } + else { + filter.type = 6; + filter.value = value; + filter.value2 = value2; + filter.text = value + ' - ' + value2; } - $WH.ae(this.tbody, tr); } } else { - for (var e = 0; e < h; ++e) { - var f = o + e, - p = this.data[f]; - if (!p) { - break - } - if (p.__hidden || p.__deleted) {++h; - continue - } - $WH.ae(this.tbody, this.getRow(f)) - } - } - } - this.mainContainer.style.display = ""; - this.noData.style.display = "none" - }, - showNoData: function() { - var b = this.noData; - $WH.ee(b); - var a = -1; - if (this.onNoData) { - a = (this.onNoData.bind(this, b))() - } - if (a == -1) { - $WH.ae(this.noData, $WH.ct(this.filtered ? LANG.lvnodata2: LANG.lvnodata)) - } - }, - getDiv: function(a) { - var b = this.data[a]; - if (b.__div == null || this.minPatchVersion != b.__minPatch) { - this.createDiv(b, a) - } - return b.__div - }, - createDiv: function(b, a) { - var c = $WH.ce("div"); - b.__div = c; - if (this.minPatchVersion) { - b.__minPatch = this.minPatchVersion - } (this.template.compute.bind(this, b, c, a))() - }, - getCell: function(a) { - var b = this.data[a]; - if (b.__div == null) { - this.createCell(b, a) - } - return b.__td - }, - createCell: function(b, a) { - var c = $WH.ce("td"); - b.__td = c; - (this.template.compute.bind(this, b, c, a))(); - if (this.template.getItemLink) { - c.onclick = this.itemClick.bind(this, b) - } - if ($WH.Browser.ie6) { - c.onmouseover = Listview.itemOver; - c.onmouseout = Listview.itemOut - } - }, - - getEvent: function(i) { - var row = this.dates[i]; - - if (row.__td == null) { - this.createEvent(row, i); - } - - return row.__td; - }, - - createEvent: function(row, i) { - row.events = $WH.array_filter(this.data, function(holiday) { - if (holiday.__hidden || holiday.__deleted) { - return false; - } - - var dates = Listview.funcBox.getEventNextDates(holiday.startDate, holiday.endDate, holiday.rec || 0, row.date); - if (dates[0] && dates[1]) { - dates[0].setHours(0, 0, 0, 0); - dates[1].setHours(0, 0, 0, 0); - return dates[0] <= row.date && dates[1] >= row.date; - } - - return false; - }); - - var td = $WH.ce('td'); - row.__td = td; - - if (row.date.getFullYear() == g_serverTime.getFullYear() && row.date.getMonth() == g_serverTime.getMonth() && row.date.getDate() == g_serverTime.getDate()) { - td.className = 'calendar-today'; - } - - var div = $WH.ce('div'); - div.className = 'calendar-date'; - $WH.st(div, row.date.getDate()); - $WH.ae(td, div); - - div = $WH.ce('div'); - div.className = 'calendar-event'; - $WH.ae(td, div); - - (this.template.compute.bind(this, row, div, i))(); - - if (this.getItemLink) { - td.onclick = this.itemClick.bind(this, row); - } - }, - - getRow: function(a) { - var b = this.data[a]; - if (b.__tr == null) { - this.createRow(b) - } - return b.__tr - }, - setRow: function(a) { - if (this.data[a.pos]) { - this.data[a.pos] = a; - this.data[a.pos].__tr = a.__tr; - this.createRow(this.data[a.pos]); - this.refreshRows() - } - }, - createRow: function(j) { - var g = $WH.ce("tr"); - j.__tr = g; - if (this.mode == Listview.MODE_CHECKBOX) { - var c = $WH.ce("td"); - if (!j.__nochk) { - c.className = "listview-cb"; - c.onclick = Listview.cbCellClick; - var b = $WH.ce("input"); - $WH.ns(b); - b.type = "checkbox"; - b.onclick = Listview.cbClick; - if (j.__chk) { - b.checked = true; - if ($WH.Browser.ie) { - b.defaultChecked = true - } - } - j.__cb = b; - $WH.ae(c, b) - } - $WH.ae(g, c) - } - for (var d = 0, e = this.visibility.length; d < e; ++d) { - var f = this.visibility[d], - a = this.columns[f], - c = $WH.ce("td"), - h; - if (a.align != null) { - c.style.textAlign = a.align - } - if (a.compute) { - h = (a.compute.bind(this, j, c, g, f))() - } else { - if (j[a.value] != null) { - h = j[a.value] - } else { - h = -1 - } - } - if (h != -1 && h != null) { - c.insertBefore($WH.ct(h), c.firstChild) - } - $WH.ae(g, c) - } - if (this.mode == Listview.MODE_CHECKBOX && j.__chk) { - g.className = "checked" - } - if (this.template.getItemLink) { - g.onclick = this.itemClick.bind(this, j) - } - if ($WH.Browser.ie6) { - g.onmouseover = Listview.itemOver; - g.onmouseout = Listview.itemOut - } - }, - itemClick: function(d, c) { - c = $WH.$E(c); - var a = 0, - b = c._target; - while (b && a < 3) { - if (b.nodeName == "A") { - return - } - b = b.parentNode - } - location.href = this.template.getItemLink(d) - }, - submitSearch: function(c) { - c = $WH.$E(c); - if (!this.onSearchSubmit || c.keyCode != 13) { - return - } - for (var b = 0, a = this.data.length; b < a; ++b) { - if (this.data[b].__hidden) { - continue - } (this.onSearchSubmit.bind(this, this.data[b]))() - } - }, - validatePage: function() { - var - c = this.nItemsPerPage, - b = this.rowOffset, - a = this.nRowsVisible; - - if (b < 0) { - this.rowOffset = 0 - } - else if(this.mode == Listview.MODE_CALENDAR) - this.rowOffset = Math.min(b, this.nDaysPerMonth.length - 1); - else { - this.rowOffset = this.getRowOffset(b + c > a ? a - 1 : b) - } - }, - getRowOffset: function(b) { - var a = this.nItemsPerPage; - return (a > 0 && b > 0 ? Math.floor(b / a) * a: 0) - }, - resetRowVisibility: function() { - for (var b = 0, a = this.data.length; b < a; ++b) { - this.data[b].__hidden = false - } - this.filtered = false; - this.rowOffset = 0; - this.nRowsVisible = this.data.length - }, - - getColText: function(row, col) { - var text = ''; - if (this.template.getVisibleText) { - text = $WH.trim(this.template.getVisibleText(row) + ' '); - } - - if (col.getVisibleText) { - return text + col.getVisibleText(row) - } - - if (col.getValue) { - return text + col.getValue(row) - } - - if (col.value) { - return text + row[col.value] - } - - if (col.compute) { - return text + col.compute(row, $WH.ce('td'), $WH.ce('tr')); - } - - return "" - }, - - updateFilters: function(d) { - Tooltip.hide(); - this.resetRowVisibility(); - var z, r, c; - if (this.searchable) { - this.quickSearchBox.parentNode.style.display = ""; - z = $WH.trim(this.quickSearchBox.value); - if (z) { - this.quickSearchGlass.style.display = "none"; - this.quickSearchClear.style.display = ""; - z = z.toLowerCase().replace(/\s+/g, " "); - r = z.split(" "); - c = r.length - } else { - this.quickSearchGlass.style.display = ""; - this.quickSearchClear.style.display = "none" - } - } else { - if (this.quickSearchBox) { - this.quickSearchBox.parentNode.style.display = "none" - } - } - if (!z && this.nFilters == 0 && this.customFilter == null) { - if (d) { - this.updateNav(); - this.refreshRows() - } - return - } - var C = { - 1 : function(i, j) { - return i > j - }, - 2 : function(i, j) { - return i == j - }, - 3 : function(i, j) { - return i < j - }, - 4 : function(i, j) { - return i >= j - }, - 5 : function(i, j) { - return i <= j - }, - 6 : function(i, k, j) { - return k <= i && i <= j - } - }; - var q = { - 1 : function(j, i, k) { - return i > k - }, - 2 : function(j, i, k) { - return j <= k && k <= i - }, - 3 : function(j, i, k) { - return j < k - }, - 4 : function(j, i, k) { - return i >= k - }, - 5 : function(j, i, k) { - return j <= k - }, - 6 : function(j, i, E, k) { - return E <= i && j <= k - } - }; - var p = 0; - for (var w = 0, y = this.data.length; w < y; ++w) { - var g = this.data[w], - m = 0; - nSearchMatches = 0, - matches = []; - g.__hidden = true; - if (this.customFilter && !this.customFilter(g, w)) { - continue - } - for (var v = 0, h = this.visibility.length; v < h; ++v) { - var o = this.visibility[v]; - var e = this.columns[o]; - if (e.__filter) { - var a = e.__filter, - b = false; - if (e.type == null || e.type == "num" || a.type > 0) { - var t = null; - if (e.getValue) { - t = e.getValue(g) - } else { - if (e.value) { - t = parseFloat(g[e.value]) - } - } - if (!t) { - t = 0 - } - b = (C[a.type])(t, a.value, a.value2) - } else { - if (e.type == "range") { - var D = e.getMinValue(g), - B = e.getMaxValue(g); - b = (q[a.type])(D, B, a.value, a.value2) - } else { - var l = this.getColText(g, e); - if (l) { - l = l.toString().toLowerCase(); - if (a.invert) { - b = l.match(a.regex) != null - } else { - var A = 0; - for (var u = 0, f = a.words.length; u < f; ++u) { - if (l.indexOf(a.words[u]) != -1) {++A - } else { - break - } - } - b = (A == a.words.length) - } - } - } - } - if (a.invert) { - b = !b - } - if (b) {++m - } else { - break - } - } - if (z) { - var l = this.getColText(g, e); - if (l) { - l = l.toString().toLowerCase(); - for (var u = 0, f = r.length; u < f; ++u) { - if (!matches[u]) { - if (l.indexOf(r[u]) != -1) { - matches[u] = 1; ++nSearchMatches - } - } - } - } - } - } - if (g.__alwaysvisible || ((this.nFilters == 0 || m == this.nFilters) && (!z || nSearchMatches == c))) { - g.__hidden = false; ++p - } - } - this.filtered = (p < this.data.length); - this.nRowsVisible = p; - if (d) { - this.updateNav(); - this.refreshRows() - } - }, - changePage: function() { - this.validatePage(); - this.refreshRows(); - this.updateNav(); - this.updatePound(); - var a = $WH.g_getScroll(), - b = $WH.ac(this.container); - if (a.y > b[1]) { - scrollTo(a.x, b[1]) - } - }, - firstPage: function() { - this.rowOffset = 0; - this.changePage(); - return false - }, - previousPage: function() { - this.rowOffset -= this.nItemsPerPage; - this.changePage(); - return false - }, - nextPage: function() { - this.rowOffset += this.nItemsPerPage; - this.changePage(); - return false - }, - lastPage: function() { - this.rowOffset = 99999999; - this.changePage(); - return false - }, - addSort: function(a, c) { - var b = $WH.in_array(a, Math.abs(c), function(d) { - return Math.abs(d) - }); - if (b != -1) { - c = a[b]; - a.splice(b, 1) - } - a.splice(0, 0, c) - }, - sortBy: function(a) { - if (a <= 0 || a > this.columns.length) { - return - } - if (Math.abs(this.sort[0]) == a) { - this.sort[0] = -this.sort[0] - } else { - var b = -1; - if (this.columns[a-1].type == "text") { - b = 1 - } - this.addSort(this.sort, b * a) - } - this.applySort(); - this.refreshRows(); - this.updateSortArrow(); - this.updatePound() - }, - applySort: function() { - if (this.sort.length == 0) { - return - } - Listview.sort = this.sort; - Listview.columns = this.columns; - if (this.indexCreated) { - this.data.sort(Listview.sortIndexedRows.bind(this)) - } else { - this.data.sort(Listview.sortRows.bind(this)) - } - this.updateSortIndex() - }, - setSort: function(b, c, a) { - if (this.sort.toString() != b.toString()) { - this.sort = b; - this.applySort(); - if (c) { - this.refreshRows() - } - if (a) { - this.updatePound() - } - } - }, - readPound: function() { - if (!this.poundable || !location.hash.length) { - return false - } - var b = location.hash.substr(1); - if (this.tabs) { - var g = b.indexOf(":"); - if (g == -1) { - return false - } - b = b.substr(g + 1) - } - var a = parseInt(b); - if (!isNaN(a)) { - this.rowOffset = a; - this.validatePage(); - if (this.poundable != 2) { - var d = []; - var f = b.match(/(\+|\-)[0-9]+/g); - if (f != null) { - for (var c = f.length - 1; c >= 0; --c) { - var e = parseInt(f[c]) | 0; - var b = Math.abs(e); - if (b <= 0 || b > this.columns.length) { - break - } - this.addSort(d, e) - } - this.setSort(d, false, false) - } - } - if (this.tabs) { - this.tabs.setTabPound(this.tabIndex, this.getTabPound()) - } - } - }, - updateSortArrow: function() { - if (!this.sort.length || !this.thead || this.mode == Listview.MODE_TILED || this.mode == Listview.MODE_CALENDAR) { - return - } - var a = $WH.in_array(this.visibility, Math.abs(this.sort[0]) - 1); - if (a == -1) { - return - } - if (this.mode == Listview.MODE_CHECKBOX) { - a += 1 - } - var b = this.thead.firstChild.childNodes[a].firstChild.firstChild.firstChild; - if (this.lsa && this.lsa != b) { - this.lsa.className = "" - } - b.className = (this.sort[0] < 0 ? "sortdesc": "sortasc"); - this.lsa = b - }, - updateSortIndex: function() { - var b = this.data; - for (var c = 0, a = b.length; c < a; ++c) { - b[c].__si = c - } - this.indexCreated = true - }, - updateTabName: function() { - if (this.tabs && this.tabIndex != null) { - this.tabs.setTabName(this.tabIndex, this.getTabName()) - } - }, - updatePound: function() { - if (!this.poundable) { - return - } - var a = this.getTabPound(); - if (this.tabs) { - this.tabs.setTabPound(this.tabIndex, a); - location.replace("#" + this.id + ":" + a) - } else { - location.replace("#" + a) - } - }, - updateNav: function() { - var e = [this.navTop, this.navBot], - j = this.nItemsPerPage, - h = this.rowOffset, - d = this.nRowsVisible, - g = 0, - b = 0, - f = 0, - k = 0 - date = new Date(); - - if (d > 0) { - if (! (this.hideNav & 1)) { - e[0].style.display = "" - } - if (! (this.hideNav & 2)) { - e[1].style.display = "" - } - } else { - e[0].style.display = e[1].style.display = "none" - } - - if (this.mode == Listview.MODE_CALENDAR) { - for (var i = 0; i < this.nDaysPerMonth.length; ++i) { - if (i == h) { // Selected month - if (i > 0) - b = 1; - if (i > 1) - g = 1; - if (i < this.nDaysPerMonth.length - 1) - f = 1; - if (i < this.nDaysPerMonth.length - 2) - k = 1; - } - } - - date.setTime(this.startOnMonth.valueOf()); - date.setMonth(date.getMonth() + h); - } - else - { - if (j) { - if (h > 0) { - b = 1; - if (h >= j + j) { - g = 1 - } + var parts = res.toLowerCase().split(' '); + if (!col.allText && parts.length == 1 && !isNaN(value = parseFloat(parts[0]))) { + filter.type = 2; + filter.value = value; + filter.text = '= ' + value; } - if (h + j < d) { - f = 1; - if (h + j + j < d) { - k = 1 + else if (col.type == 'text') { + filter.type = 0; + filter.text = res; + + if (filter.invert) { + filter.regex = g_createOrRegex(res); + } + else { + filter.words = parts; } } } - } - for (var c = 0; c < 2; ++c) { - var a = e[c].childNodes; - a[0].style.display = (g ? "": "none"); - a[1].style.display = (b ? "": "none"); - a[3].style.display = (f ? "": "none"); - a[4].style.display = (k ? "": "none"); - a = a[2].childNodes; - - if (this.mode == Listview.MODE_CALENDAR) - a[0].firstChild.nodeValue = LANG.date_months[date.getMonth()] + ' ' + date.getFullYear(); - else { - a[0].firstChild.nodeValue = h + 1; - a[2].firstChild.nodeValue = j ? Math.min(h + j, d) : d; - a[4].firstChild.nodeValue = d; + if (filter.type == -1) { + alert(LANG.message_invalidfilter); + return; } - } - }, - getTabName: function() { - var b = this.name, - d = this.data.length; - for (var c = 0, a = this.data.length; c < a; ++c) { - if (this.data[c].__hidden || this.data[c].__deleted) {--d - } - } - if (d > 0 && !this.hideCount) { - b += $WH.sprintf(LANG.qty, d) - } - return b - }, - getTabPound: function() { - var a = ""; - a += this.rowOffset; - if (this.poundable != 2 && this.sort.length) { - a += ("+" + this.sort.join("+")).replace(/\+\-/g, "-") - } - return a - }, - getCheckedRows: function() { - var d = []; - for (var c = 0, a = this.data.length; c < a; ++c) { - var b = this.data[c]; - if ((b.__cb && b.__cb.checked) || (!b.__cb && b.__chk)) { - d.push(b) - } - } - return d - }, - deleteRows: function(c) { - if (!c || !c.length) { - return - } - for (var b = 0, a = c.length; b < a; ++b) { - var d = c[b]; - if (!d.__hidden && !d.__hidden) { - this.nRowsVisible -= 1 - } - d.__deleted = true - } - this.updateTabName(); - if (this.rowOffset >= this.nRowsVisible) { - this.previousPage() - } else { - this.refreshRows(); - this.updateNav() - } - }, - setData: function(a) { - this.data = a; - this.indexCreated = false; - this.resetRowVisibility(); - if (this.tabs) { - this.pounded = (this.tabs.poundedTab == this.tabIndex); - if (this.pounded) { - this.readPound() - } - } else { - this.readPound() - } - this.applySort(); - this.updateSortArrow(); - if (this.customFilter != null) { - this.updateFilters() - } - this.updateNav(); - this.refreshRows() - }, - getClipDiv: function() { - return this.clipDiv - }, - getNoteTopDiv: function() { - return this.noteTop - }, - focusSearch: function() { - this.quickSearchBox.focus() - }, - clearSearch: function() { - this.quickSearchBox.value = "" - }, - getList: function() { - if (!this.debug) { - return - } - var b = ""; - for (var a = 0; a < this.data.length; a++) { - if (!this.data[a].__hidden) { - b += this.data[a].id + ", " - } - } - prompt("", b) - } + } + + if (!col.__filter || filter.text != col.__filter.text || filter.invert != col.__filter.invert) { + var a = col.__th.firstChild.firstChild; + + if (res && filter.text) { + if (!col.__filter) { + a.className = 'q5'; + ++(this.nFilters); + } + + col.__filter = filter; + } + else { + if (col.__filter) { + a.className = ''; + --(this.nFilters); + } + + col.__filter = null; + } + + this.updateFilters(1); + } + } }; -Listview.sortRows = function(e, d) { - var j = Listview.sort, - k = Listview.columns; - for (var h = 0, c = j.length; h < c; ++h) { - var g, f = k[Math.abs(j[h]) - 1]; - if (!f) - f = this.template; - if (f.sortFunc) { - g = f.sortFunc(e, d, j[h]) - } else { - g = $WH.strcmp(e[f.value], d[f.value]) - } - if (g != 0) { - return g * j[h] - } - } - return 0 -}, -Listview.sortIndexedRows = function(d, c) { - var g = Listview.sort, - h = Listview.columns, - e = h[Math.abs(g[0]) - 1], - f; - if (e.sortFunc) { - f = e.sortFunc(d, c, g[0]) - } else { - f = $WH.strcmp(d[e.value], c[e.value]) - } - if (f != 0) { - return f * g[0] - } - return (d.__si - c.__si) -}, -Listview.cbSelect = function(b) { - for (var d = 0, a = this.data.length; d < a; ++d) { - var c = this.data[d]; - var f = b; - if (!c.__nochk && c.__tr) { - var e = c.__tr.firstChild.firstChild; - if (f == null) { - f = !e.checked - } - if (e.checked != f) { - e.checked = f; - c.__tr.className = (e.checked ? "checked": ""); - if ($WH.Browser.ie) { - e.defaultChecked = f; - if ($WH.Browser.ie6) { (Listview.itemOut.bind(c.__tr))() - } - } - } - } else { - if (f == null) { - f = true - } - } - c.__chk = f - } -}; -Listview.cbClick = function(a) { - setTimeout(Listview.cbUpdate.bind(0, 0, this, this.parentNode.parentNode), 1); - $WH.sp(a) -}; -Listview.cbCellClick = function(a) { - setTimeout(Listview.cbUpdate.bind(0, 1, this.firstChild, this.parentNode), 1); - $WH.sp(a) -}; -Listview.cbIeFix = function() { - var d = $WH.gE(this.tbody, "tr"); - for (var c = 0, a = d.length; c < a; ++c) { - var b = d[c].firstChild.firstChild; - if (b) { - b.checked = b.defaultChecked = false - } - } -}; -Listview.cbUpdate = function(c, a, b) { - if (c) { - a.checked = !a.checked - } - b.className = (a.checked ? "checked": ""); - if ($WH.Browser.ie) { - a.defaultChecked = a.checked; - if ($WH.Browser.ie6) { (Listview.itemOver.bind(b))() - } - } -}; -Listview.itemOver = function() { - this.style.backgroundColor = (this.className == "checked" ? "#2C2C2C": "#202020") -}; -Listview.itemOut = function() { - this.style.backgroundColor = (this.className == "checked" ? "#242424": "transparent") -}; -Listview.headerClick = function(a, b, c) { - c = $WH.$E(c); - if (c._button == 3 || c.shiftKey || c.ctrlKey) { - Tooltip.hide(); - setTimeout(Listview.headerFilter.bind(this, a, null), 1) - } else { - this.sortBy(b + 1) - } - return false -}; -Listview.headerFilter = function(c, f) { - var j = ""; - if (c.__filter) { - if (c.__filter.invert) { - j += "!" - } - j += c.__filter.text - } - if (f == null) { - var f = prompt($WH.sprintf(LANG.prompt_colfilter1 + (c.type == "text" ? LANG.prompt_colfilter2: LANG.prompt_colfilter3), c.name), j) - } - if (f != null) { - var e = { - text: "", - type: -1 - }; - f = $WH.trim(f.replace(/\s+/g, " ")); - if (f) { - if (f.charAt(0) == "!" || f.charAt(0) == "-") { - e.invert = 1; - f = f.substr(1) - } - if (c.type == "text") { - e.type = 0; - e.text = f; - if (e.invert) { - e.regex = g_createOrRegex(f) - } else { - e.words = f.toLowerCase().split(" ") - } - } - var i, b; - if (f.match(/(>|=|<|>=|<=)\s*([0-9\.]+)/)) { - i = parseFloat(RegExp.$2); - if (!isNaN(i)) { - switch (RegExp.$1) { - case ">": - e.type = 1; - break; - case "=": - e.type = 2; - break; - case "<": - e.type = 3; - break; - case ">=": - e.type = 4; - break; - case "<=": - e.type = 5; - break - } - e.value = i; - e.text = RegExp.$1 + " " + i - } - } else { - if (f.match(/([0-9\.]+)\s*\-\s*([0-9\.]+)/)) { - i = parseFloat(RegExp.$1); - b = parseFloat(RegExp.$2); - if (!isNaN(i) && !isNaN(b)) { - if (i > b) { - var g = i; - i = b; - b = g - } - if (i == b) { - e.type = 2; - e.value = i; - e.text = "= " + i - } else { - e.type = 6; - e.value = i; - e.value2 = b; - e.text = i + " - " + b - } - } - } else { - var d = f.toLowerCase().split(" "); - if (d.length == 1 && !isNaN(i = parseFloat(d[0]))) { - e.type = 2; - e.value = i; - e.text = "= " + i - } else { - if (c.type == "text") { - e.type = 0; - e.text = f; - if (e.invert) { - e.regex = g_createOrRegex(f) - } else { - e.words = d - } - } - } - } - } - if (e.type == -1) { - alert(LANG.message_invalidfilter); - return - } - } - if (!c.__filter || e.text != c.__filter.text || e.invert != c.__filter.invert) { - var h = c.__th.firstChild.firstChild; - if (f && e.text) { - if (!c.__filter) { - h.className = "q5"; ++(this.nFilters) - } - c.__filter = e - } else { - if (c.__filter) { - h.className = ""; --(this.nFilters) - } - c.__filter = null - } - this.updateFilters(1) - } - } -}; -Listview.headerOver = function(b, c, f) { - var d = ""; - d += '' + (c.tooltip ? c.tooltip: c.name) + ""; - if (c.__filter) { - d += "
    " + $WH.sprintf((c.__filter.invert ? LANG.tooltip_colfilter2: LANG.tooltip_colfilter1), c.__filter.text) - } - d += '
    ' + LANG.tooltip_lvheader1 + ""; - if (this.filtrable && (c.filtrable == null || c.filtrable)) { - d += '
    ' + ($WH.Browser.opera ? LANG.tooltip_lvheader3: LANG.tooltip_lvheader2) + "" - } - Tooltip.show(b, d, 0, 0, "q") + +Listview.headerOver = function(a, col, e) { + var buffer = ''; + + buffer += '' + (col.tooltip ? col.tooltip: col.name) + ''; + + if (col.__filter) { + buffer += '
    ' + $WH.sprintf((col.__filter.invert ? LANG.tooltip_colfilter2: LANG.tooltip_colfilter1), col.__filter.text); + } + + buffer += '
    ' + LANG.tooltip_lvheader1 + ''; + if (this.filtrable && (col.filtrable == null || col.filtrable)) { + buffer += '
    ' + ($WH.Browser.opera ? LANG.tooltip_lvheader3: LANG.tooltip_lvheader2) + ''; + } + + $WH.Tooltip.show(a, buffer, 0, 0, 'q'); }; + Listview.extraCols = { id: { id: 'id', @@ -5060,11 +5672,11 @@ Listview.funcBox = { return g_quest_sorts[category]; }, - getQuestReputation: function(d, b) { - if (b.reprewards) { - for (var c = 0, a = b.reprewards.length; c < a; ++c) { - if (b.reprewards[c][0] == d) { - return b.reprewards[c][1] + getQuestReputation: function(faction, quest) { + if (quest.reprewards) { + for (var c = 0, a = quest.reprewards.length; c < a; ++c) { + if (quest.reprewards[c][0] == faction) { + return quest.reprewards[c][1]; } } } @@ -5325,7 +5937,7 @@ Listview.funcBox = { e.rating += a; e.raters.push([g_user.id, a]); var b = e.divHeader.firstChild; - Tooltip.hide(); + $WH.Tooltip.hide(); b = b.childNodes[b.childNodes.length - 3]; var f = $WH.ge("commentrating" + e.id); Listview.funcBox.coDisplayRating(e, f); @@ -6102,13 +6714,13 @@ Listview.funcBox = { return true }, coCustomRatingOver: function(a) { - Tooltip.showAtCursor(a, LANG.tooltip_customrating, 0, 0, "q") + $WH.Tooltip.showAtCursor(a, LANG.tooltip_customrating, 0, 0, "q") }, coPlusRatingOver: function(a) { - Tooltip.showAtCursor(a, LANG.tooltip_uprate, 0, 0, "q2") + $WH.Tooltip.showAtCursor(a, LANG.tooltip_uprate, 0, 0, "q2") }, coMinusRatingOver: function(a) { - Tooltip.showAtCursor(a, LANG.tooltip_downrate, 0, 0, "q10") + $WH.Tooltip.showAtCursor(a, LANG.tooltip_downrate, 0, 0, "q10") }, coSortDate: function(a) { a.nextSibling.nextSibling.className = ""; @@ -6218,7 +6830,7 @@ Listview.funcBox = { buff = LANG.allday; } - Tooltip.showAtCursor(e, '' + event.name + '
    ' + buff, 0, 0, 'q'); + $WH.Tooltip.showAtCursor(e, '' + event.name + '
    ' + buff, 0, 0, 'q'); }, ssCellOver: function() { @@ -6284,18 +6896,18 @@ Listview.funcBox = { }, moneyHonorOver: function(e) { - Tooltip.showAtCursor(e, '' + LANG.tooltip_honorpoints + '', 0, 0, 'q1'); + $WH.Tooltip.showAtCursor(e, '' + LANG.tooltip_honorpoints + '', 0, 0, 'q1'); }, moneyArenaOver: function(e) { - Tooltip.showAtCursor(e, '' + LANG.tooltip_arenapoints + '', 0, 0, 'q1'); + $WH.Tooltip.showAtCursor(e, '' + LANG.tooltip_arenapoints + '', 0, 0, 'q1'); }, moneyAchievementOver: function(e) { - Tooltip.showAtCursor(e, '' + LANG.tooltip_achievementpoints + '', 0, 0, 'q1'); + $WH.Tooltip.showAtCursor(e, '' + LANG.tooltip_achievementpoints + '', 0, 0, 'q1'); }, - appendMoney: function(g, a, f, m, j, c, l) { + appendMoney: function(g, a, f, m, j, c, l) { // todo: understand and adapt var k, h = 0; if (a >= 10000) { h = 1; @@ -6337,8 +6949,8 @@ Listview.funcBox = { k = $WH.ce("span"); k.className = "money" + (m < 0 ? "horde": "alliance") + " tip"; k.onmouseover = Listview.funcBox.moneyHonorOver; - k.onmousemove = Tooltip.cursorUpdate; - k.onmouseout = Tooltip.hide; + k.onmousemove = $WH.Tooltip.cursorUpdate; + k.onmouseout = $WH.Tooltip.hide; $WH.ae(k, $WH.ct($WH.number_format(Math.abs(m)))); $WH.ae(g, k) } @@ -6351,8 +6963,8 @@ Listview.funcBox = { k = $WH.ce("span"); k.className = "moneyarena tip"; k.onmouseover = Listview.funcBox.moneyArenaOver; - k.onmousemove = Tooltip.cursorUpdate; - k.onmouseout = Tooltip.hide; + k.onmousemove = $WH.Tooltip.cursorUpdate; + k.onmouseout = $WH.Tooltip.hide; $WH.ae(k, $WH.ct($WH.number_format(j))); $WH.ae(g, k) } @@ -6382,8 +6994,8 @@ Listview.funcBox = { k = $WH.ce("span"); k.className = "moneyachievement tip"; k.onmouseover = Listview.funcBox.moneyAchievementOver; - k.onmousemove = Tooltip.cursorUpdate; - k.onmouseout = Tooltip.hide; + k.onmousemove = $WH.Tooltip.cursorUpdate; + k.onmouseout = $WH.Tooltip.hide; $WH.ae(k, $WH.ct($WH.number_format(l))); $WH.ae(g, k) } @@ -6495,7 +7107,7 @@ Listview.templates = { compute: function(faction, td) { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(faction); + a.href = this.getItemLink(faction); $WH.ae(a, $WH.ct(faction.name)); if (faction.expansion) { var sp = $WH.ce('span'); @@ -6618,7 +7230,7 @@ Listview.templates = { var a = $WH.ce('a'); a.className = 'q' + (7 - parseInt(item.name.charAt(0))); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(item); + a.href = this.getItemLink(item); if (item.rel) { Icon.getLink(i.firstChild).rel = item.rel; @@ -7284,7 +7896,7 @@ Listview.templates = { var a = $WH.ce('a'); a.className = 'q' + (7 - parseInt(itemSet.name.charAt(0))); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(itemSet); + a.href = this.getItemLink(itemSet); $WH.ae(a, $WH.ct(itemSet.name.substring(1))); var div = $WH.ce('div'); @@ -7447,7 +8059,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(npc); + a.href = this.getItemLink(npc); $WH.ae(a, $WH.ct(npc.name)); $WH.ae(td, a); @@ -7660,7 +8272,7 @@ Listview.templates = { compute: function(object, td) { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(object); + a.href = this.getItemLink(object); $WH.ae(a, $WH.ct(object.name)); $WH.ae(td, a); } @@ -7728,7 +8340,7 @@ Listview.templates = { var wrapper = $WH.ce('div'); var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(quest); + a.href = this.getItemLink(quest); $WH.ae(a, $WH.ct(quest.name)); $WH.ae(wrapper, a); @@ -8064,7 +8676,7 @@ Listview.templates = { i.style.padding = '0'; i.style.borderRight = 'none'; - $WH.ae(i, Icon.create(skill.icon, 0, null, this.template.getItemLink(skill))); + $WH.ae(i, Icon.create(skill.icon, 0, null, this.getItemLink(skill))); $WH.ae(tr, i); td.style.borderLeft = 'none'; @@ -8072,7 +8684,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(skill); + a.href = this.getItemLink(skill); $WH.ae(a, $WH.ct(skill.name)); if (skill.expansion) { @@ -8164,7 +8776,7 @@ Listview.templates = { a.className = 'q' + (7 - parseInt(c)); } a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(spell); + a.href = this.getItemLink(spell); $WH.ae(a, $WH.ct(spell.name.substring(1))); @@ -9068,7 +9680,7 @@ Listview.templates = { compute: function(zone, td) { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(zone); + a.href = this.getItemLink(zone); $WH.ae(a, $WH.ct(zone.name)); if (zone.expansion) { var sp = $WH.ce('span'); @@ -9297,7 +9909,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(holiday); + a.href = this.getItemLink(holiday); $WH.ae(a, $WH.ct(holiday.name)); $WH.ae(td, a); }, @@ -9423,8 +10035,8 @@ Listview.templates = { for (var i = 0; i < holiday.events.length; ++i) { var icon = g_holidays.createIcon(holiday.events[i].id, 1); icon.onmouseover = Listview.funcBox.dateEventOver.bind(icon, holiday.date, holiday.events[i]); - icon.onmousemove = Tooltip.cursorUpdate; - icon.onmouseout = Tooltip.hide; + icon.onmousemove = $WH.Tooltip.cursorUpdate; + icon.onmouseout = $WH.Tooltip.hide; icon.style.cssFloat = icon.style.styleFloat = 'left'; $WH.ae(div, icon); } @@ -9449,943 +10061,1023 @@ Listview.templates = { } }, - comment: { - sort: [1], - mode: 2, - nItemsPerPage: 40, - poundable: 2, - columns: [{ - value: "number" - }, - { - value: "id" - }, - { - value: "rating" - }], - compute: function(J, ac, ab) { - var ag, I = new Date(J.date), - Y = (g_serverTime - I) / 1000, - h = (g_user.roles & U_GROUP_COMMENTS_MODERATOR) != 0, - ad = J.rating < 0 || J.purged || J.deleted || (J.__minPatch && g_getPatchVersion.T[J.__minPatch] > I), - U = h || (J.user.toLowerCase() == g_user.name.toLowerCase() && !g_user.commentban), - L = U && J.deleted == 0, - d = U && J.replyTo != J.id, - af = true, - W = J.purged == 0 && J.deleted == 0 && g_user.id && J.user.toLowerCase() != g_user.name.toLowerCase() && $WH.in_array(J.raters, g_user.id, function(i) { - return i[0] - }) == -1 && !g_user.ratingban, - p = J.rating >= 0 && (g_user.id == 0 || W || g_user.ratingban), - G = g_users[J.user]; + comment: { // todo: reformat + sort: [1], + mode: 2, + nItemsPerPage: 40, + poundable: 2, + columns: [{ + value: "number" + }, + { + value: "id" + }, + { + value: "rating" + }], + compute: function(J, ac, ab) { + var ag, I = new Date(J.date), + Y = (g_serverTime - I) / 1000, + h = (g_user.roles & U_GROUP_COMMENTS_MODERATOR) != 0, + ad = J.rating < 0 || J.purged || J.deleted || (J.__minPatch && g_getPatchVersion.T[J.__minPatch] > I), + U = h || (J.user.toLowerCase() == g_user.name.toLowerCase() && !g_user.commentban), + L = U && J.deleted == 0, + d = U && J.replyTo != J.id, + af = true, + W = J.purged == 0 && J.deleted == 0 && g_user.id && J.user.toLowerCase() != g_user.name.toLowerCase() && $WH.in_array(J.raters, g_user.id, function(i) { + return i[0] + }) == -1 && !g_user.ratingban, + p = J.rating >= 0 && (g_user.id == 0 || W || g_user.ratingban), + G = g_users[J.user]; J.ratable = W; - var aa = ac; - var N = $WH.ce("div"); - var z = $WH.ce("div"); - var t = $WH.ce("em"); - J.divHeader = N; - J.divBody = z; - J.divLinks = t; - aa.className = "comment-wrapper"; - if (J.indent) { - aa.className += " comment-indent" - } - if (ad) { - aa.className += " comment-collapsed" - } - ac = $WH.ce("div"); - ac.className = "comment comment" + (ab % 2); - $WH.ae(aa, ac); - N.className = "comment-header"; - $WH.ae(ac, N); - var n = $WH.ce("em"); - n.className = "comment-rating"; - if (ad) { - var D = $WH.ce("a"); - D.href = "javascript:;"; - D.onclick = Listview.funcBox.coToggleVis.bind(D, J); - $WH.ae(D, $WH.ct(LANG.lvcomment_show)); - $WH.ae(n, D); - $WH.ae(n, $WH.ct(" " + String.fromCharCode(160) + " ")) - } - var A = $WH.ce("b"); - var v = $WH.ce("a"); - v.href = "javascript:;"; - $WH.ae(v, $WH.ct(LANG.lvcomment_rating)); - var E = $WH.ce("span"); - E.id = "commentrating" + J.id; - Listview.funcBox.coDisplayRating(J, E); - v.onclick = Listview.funcBox.coToggleRating.bind(this, J, E); - $WH.ae(v, E); - $WH.ae(A, v); - $WH.ae(n, A); - $WH.ae(n, $WH.ct(" ")); - var S = $WH.ce("span"); - var q = $WH.ce("a"), - af = $WH.ce("a"); - if (W) { - q.href = af.href = "javascript:;"; - q.onclick = Listview.funcBox.coRate.bind(q, J, 1); - af.onclick = Listview.funcBox.coRate.bind(af, J, -1); - if (h) { - var R = $WH.ce("a"); - R.href = "javascript:;"; - R.onclick = Listview.funcBox.coRate.bind(R, J, 0); - R.onmouseover = Listview.funcBox.coCustomRatingOver; - R.onmousemove = Tooltip.cursorUpdate; - R.onmouseout = Tooltip.hide; - $WH.ae(R, $WH.ct("[~]")) - $WH.ae(S, R); - $WH.ae(S, $WH.ct(" ")) - } - } else { - if (g_user.ratingban) { - q.href = af.href = "javascript:;" - } else { - q.href = af.href = "?account=signin" - } - } - $WH.ae(q, $WH.ct("[+]")) - if (!g_user.ratingban) { - q.onmouseover = Listview.funcBox.coPlusRatingOver; - af.onmouseover = Listview.funcBox.coMinusRatingOver; - q.onmousemove = af.onmousemove = Tooltip.cursorUpdate; - q.onmouseout = af.onmouseout = Tooltip.hide - } else { - g_addTooltip(q, LANG.tooltip_banned_rating, "q"); - g_addTooltip(af, LANG.tooltip_banned_rating, "q") - } - $WH.ae(af, $WH.ct("[-]")) - $WH.ae(S, af); - $WH.ae(S, $WH.ct(" ")); - $WH.ae(S, q); - $WH.ae(n, S); - if (!p) { - S.style.display = "none" - } - $WH.ae(N, n); - t.className = "comment-links"; - var c = false; - if (U) { - var b = $WH.ce("span"); - var Q = $WH.ce("a"); - $WH.ae(Q, $WH.ct(LANG.lvcomment_edit)); - Q.onclick = Listview.funcBox.coEdit.bind(this, J, 0, false); - $WH.ns(Q); - Q.href = "javascript:;"; - $WH.ae(b, Q); - c = true; - $WH.ae(t, b) - } - if (L) { - var u = $WH.ce("span"); - var F = $WH.ce("a"); - $WH.ae(F, $WH.ct(LANG.lvcomment_delete)); - F.onclick = Listview.funcBox.coDelete.bind(this, J); - $WH.ns(F); - F.href = "javascript:;"; - if (c) { + var aa = ac; + var N = $WH.ce("div"); + var z = $WH.ce("div"); + var t = $WH.ce("em"); + J.divHeader = N; + J.divBody = z; + J.divLinks = t; + aa.className = "comment-wrapper"; + if (J.indent) { + aa.className += " comment-indent" + } + if (ad) { + aa.className += " comment-collapsed" + } + ac = $WH.ce("div"); + ac.className = "comment comment" + (ab % 2); + $WH.ae(aa, ac); + N.className = "comment-header"; + $WH.ae(ac, N); + var n = $WH.ce("em"); + n.className = "comment-rating"; + if (ad) { + var D = $WH.ce("a"); + D.href = "javascript:;"; + D.onclick = Listview.funcBox.coToggleVis.bind(D, J); + $WH.ae(D, $WH.ct(LANG.lvcomment_show)); + $WH.ae(n, D); + $WH.ae(n, $WH.ct(" " + String.fromCharCode(160) + " ")) + } + var A = $WH.ce("b"); + var v = $WH.ce("a"); + v.href = "javascript:;"; + $WH.ae(v, $WH.ct(LANG.lvcomment_rating)); + var E = $WH.ce("span"); + E.id = "commentrating" + J.id; + Listview.funcBox.coDisplayRating(J, E); + v.onclick = Listview.funcBox.coToggleRating.bind(this, J, E); + $WH.ae(v, E); + $WH.ae(A, v); + $WH.ae(n, A); + $WH.ae(n, $WH.ct(" ")); + var S = $WH.ce("span"); + var q = $WH.ce("a"), + af = $WH.ce("a"); + if (W) { + q.href = af.href = "javascript:;"; + q.onclick = Listview.funcBox.coRate.bind(q, J, 1); + af.onclick = Listview.funcBox.coRate.bind(af, J, -1); + if (h) { + var R = $WH.ce("a"); + R.href = "javascript:;"; + R.onclick = Listview.funcBox.coRate.bind(R, J, 0); + R.onmouseover = Listview.funcBox.coCustomRatingOver; + R.onmousemove = $WH.Tooltip.cursorUpdate; + R.onmouseout = $WH.Tooltip.hide; + $WH.ae(R, $WH.ct("[~]")) + $WH.ae(S, R); + $WH.ae(S, $WH.ct(" ")) + } + } else { + if (g_user.ratingban) { + q.href = af.href = "javascript:;" + } else { + q.href = af.href = "?account=signin" + } + } + $WH.ae(q, $WH.ct("[+]")) + if (!g_user.ratingban) { + q.onmouseover = Listview.funcBox.coPlusRatingOver; + af.onmouseover = Listview.funcBox.coMinusRatingOver; + q.onmousemove = af.onmousemove = $WH.Tooltip.cursorUpdate; + q.onmouseout = af.onmouseout = $WH.Tooltip.hide + } else { + g_addTooltip(q, LANG.tooltip_banned_rating, "q"); + g_addTooltip(af, LANG.tooltip_banned_rating, "q") + } + $WH.ae(af, $WH.ct("[-]")) + $WH.ae(S, af); + $WH.ae(S, $WH.ct(" ")); + $WH.ae(S, q); + $WH.ae(n, S); + if (!p) { + S.style.display = "none" + } + $WH.ae(N, n); + t.className = "comment-links"; + var c = false; + if (U) { + var b = $WH.ce("span"); + var Q = $WH.ce("a"); + $WH.ae(Q, $WH.ct(LANG.lvcomment_edit)); + Q.onclick = Listview.funcBox.coEdit.bind(this, J, 0, false); + $WH.ns(Q); + Q.href = "javascript:;"; + $WH.ae(b, Q); + c = true; + $WH.ae(t, b) + } + if (L) { + var u = $WH.ce("span"); + var F = $WH.ce("a"); + $WH.ae(F, $WH.ct(LANG.lvcomment_delete)); + F.onclick = Listview.funcBox.coDelete.bind(this, J); + $WH.ns(F); + F.href = "javascript:;"; + if (c) { var e = $WH.ce("span"); e.style.color = "white"; $WH.ae(e, $WH.ct("|")); - $WH.ae(t, e) - } - $WH.ae(u, F); - $WH.ae(t, u) - c = true; - } - if (d) { - var P = $WH.ce("span"); - var k = $WH.ce("a"); - $WH.ae(k, $WH.ct(LANG.lvcomment_detach)); - k.onclick = Listview.funcBox.coDetach.bind(this, J); - $WH.ns(k); - k.href = "javascript:;"; - if (c) { + $WH.ae(t, e) + } + $WH.ae(u, F); + $WH.ae(t, u) + c = true; + } + if (d) { + var P = $WH.ce("span"); + var k = $WH.ce("a"); + $WH.ae(k, $WH.ct(LANG.lvcomment_detach)); + k.onclick = Listview.funcBox.coDetach.bind(this, J); + $WH.ns(k); + k.href = "javascript:;"; + if (c) { var e = $WH.ce("span"); e.style.color = "white"; $WH.ae(e, $WH.ct("|")); - $WH.ae(t, e) - } - $WH.ae(P, k); - $WH.ae(t, P) - c = true; - } - if (af) { - var K = $WH.ce("span"); - var m = $WH.ce("a"); - $WH.ae(m, $WH.ct(LANG.lvcomment_report)); - m.onclick = ContactTool.show.bind(ContactTool, { - mode: 1, - comment: J - }); - m.className = "report-icon"; - m.href = "javascript:;"; - g_addTooltip(m, LANG.report_tooltip, "q2"); - if (c) { + $WH.ae(t, e) + } + $WH.ae(P, k); + $WH.ae(t, P) + c = true; + } + if (af) { + var K = $WH.ce("span"); + var m = $WH.ce("a"); + $WH.ae(m, $WH.ct(LANG.lvcomment_report)); + m.onclick = ContactTool.show.bind(ContactTool, { + mode: 1, + comment: J + }); + m.className = "report-icon"; + m.href = "javascript:;"; + g_addTooltip(m, LANG.report_tooltip, "q2"); + if (c) { var e = $WH.ce("span"); e.style.color = "white"; $WH.ae(e, $WH.ct("|")); - $WH.ae(t, e) - } - $WH.ae(K, m); - $WH.ae(t, K) - c = true; - } - if (!g_user.commentban) { - var l = $WH.ce("span"); - var o = $WH.ce("a"); - $WH.ae(o, $WH.ct(LANG.lvcomment_reply)); - if (g_user.id > 0) { - o.onclick = Listview.funcBox.coReply.bind(this, J); - o.href = "javascript:;" - } else { - o.href = "?account=signin" - } - if (c) { + $WH.ae(t, e) + } + $WH.ae(K, m); + $WH.ae(t, K) + c = true; + } + if (!g_user.commentban) { + var l = $WH.ce("span"); + var o = $WH.ce("a"); + $WH.ae(o, $WH.ct(LANG.lvcomment_reply)); + if (g_user.id > 0) { + o.onclick = Listview.funcBox.coReply.bind(this, J); + o.href = "javascript:;" + } else { + o.href = "?account=signin" + } + if (c) { var e = $WH.ce("span"); e.style.color = "white"; $WH.ae(e, $WH.ct("|")); - $WH.ae(t, e) - } - $WH.ae(l, o); - $WH.ae(t, l) - c = true; - } - if (ad) { - z.style.display = "none"; - t.style.display = "none" - } - $WH.ae(N, t); - var C = $WH.ce("var"); - $WH.ae(C, $WH.ct(LANG.lvcomment_by)); - aUser = $WH.ce("a"); - aUser.href = "?user=" + J.user; - $WH.ae(aUser, $WH.ct(J.user)); - $WH.ae(C, aUser); - $WH.ae(C, $WH.ct(" ")); - var a = $WH.ce("a"); - a.className = "q0"; - a.id = "comments:id=" + J.id; - a.href = "#" + a.id; - g_formatDate(a, Y, I); - $WH.ae(C, a); - $WH.ae(C, $WH.ct($WH.sprintf(LANG.lvcomment_patch, g_getPatchVersion(I)))); - if (G != null && G.avatar) { - var j = Icon.createUser(G.avatar, G.avatarmore, 0, null, ((G.roles & U_GROUP_PREMIUM) ? (G.border ? 2 : 1) : 0)); - j.style.marginRight = "3px"; - j.style.cssFloat = j.style.styleFloat = "left"; - $WH.ae(N, j); - C.style.lineHeight = "26px" - } - $WH.ae(N, C); - z.className = "text comment-body" + Listview.funcBox.coGetColor(J); - if (J.indent) { - z.className += " comment-body-indent" - } - B = (this.id == "english-comments" ? "www": ""); - z.innerHTML = Markup.toHtml(J.body, { - mode: Markup.MODE_COMMENT, - roles: J.roles, - locale: B - }); - $WH.ae(ac, z); - var H = $WH.ce("div"); - H.className = "text comment-body"; - if (J.indent) { - H.className += " comment-body-indent" - } - if (J.response) { - H.innerHTML = Markup.toHtml("[div][/div][wowheadresponse=" + J.responseuser + " roles=" + J.responseroles + "]" + J.response + "[/wowheadresponse]", { - allow: Markup.CLASS_STAFF, - roles: J.responseroles, - uid: "resp-" + J.id - }) - } - $WH.ae(ac, H); - J.divResponse = H; - if ((J.roles & U_GROUP_COMMENTS_MODERATOR) == 0 || g_user.roles & U_GROUP_COMMENTS_MODERATOR) { - var X = $WH.ce("div"); - J.divLastEdit = X; - X.className = "comment-lastedit"; - $WH.ae(X, $WH.ct(LANG.lvcomment_lastedit)); - var w = $WH.ce("a"); - $WH.ae(w, $WH.ct(" ")); - $WH.ae(X, w); - $WH.ae(X, $WH.ct(" ")); - var O = $WH.ce("span"); - $WH.ae(X, O); - $WH.ae(X, $WH.ct(" ")); - Listview.funcBox.coUpdateLastEdit(J); - if (ad) { - X.style.display = "none" - } - $WH.ae(ac, X) - } - }, + $WH.ae(t, e) + } + $WH.ae(l, o); + $WH.ae(t, l) + c = true; + } + if (ad) { + z.style.display = "none"; + t.style.display = "none" + } + $WH.ae(N, t); + var C = $WH.ce("var"); + $WH.ae(C, $WH.ct(LANG.lvcomment_by)); + aUser = $WH.ce("a"); + aUser.href = "?user=" + J.user; + $WH.ae(aUser, $WH.ct(J.user)); + $WH.ae(C, aUser); + $WH.ae(C, $WH.ct(" ")); + var a = $WH.ce("a"); + a.className = "q0"; + a.id = "comments:id=" + J.id; + a.href = "#" + a.id; + g_formatDate(a, Y, I); + $WH.ae(C, a); + $WH.ae(C, $WH.ct($WH.sprintf(LANG.lvcomment_patch, g_getPatchVersion(I)))); + if (G != null && G.avatar) { + var j = Icon.createUser(G.avatar, G.avatarmore, 0, null, ((G.roles & U_GROUP_PREMIUM) ? (G.border ? 2 : 1) : 0)); + j.style.marginRight = "3px"; + j.style.cssFloat = j.style.styleFloat = "left"; + $WH.ae(N, j); + C.style.lineHeight = "26px" + } + $WH.ae(N, C); + z.className = "text comment-body" + Listview.funcBox.coGetColor(J); + if (J.indent) { + z.className += " comment-body-indent" + } + B = (this.id == "english-comments" ? "www": ""); + z.innerHTML = Markup.toHtml(J.body, { + mode: Markup.MODE_COMMENT, + roles: J.roles, + locale: B + }); + $WH.ae(ac, z); + var H = $WH.ce("div"); + H.className = "text comment-body"; + if (J.indent) { + H.className += " comment-body-indent" + } + if (J.response) { + H.innerHTML = Markup.toHtml("[div][/div][wowheadresponse=" + J.responseuser + " roles=" + J.responseroles + "]" + J.response + "[/wowheadresponse]", { + allow: Markup.CLASS_STAFF, + roles: J.responseroles, + uid: "resp-" + J.id + }) + } + $WH.ae(ac, H); + J.divResponse = H; + if ((J.roles & U_GROUP_COMMENTS_MODERATOR) == 0 || g_user.roles & U_GROUP_COMMENTS_MODERATOR) { + var X = $WH.ce("div"); + J.divLastEdit = X; + X.className = "comment-lastedit"; + $WH.ae(X, $WH.ct(LANG.lvcomment_lastedit)); + var w = $WH.ce("a"); + $WH.ae(w, $WH.ct(" ")); + $WH.ae(X, w); + $WH.ae(X, $WH.ct(" ")); + var O = $WH.ce("span"); + $WH.ae(X, O); + $WH.ae(X, $WH.ct(" ")); + Listview.funcBox.coUpdateLastEdit(J); + if (ad) { + X.style.display = "none" + } + $WH.ae(ac, X) + } + }, /* no idea what the new one does exactly.. so saved this old compute - compute: function(v, K) { - var O, u = new Date(v.date), - I = (g_serverTime - u) / 1000, - d = (g_user.roles & 26) != 0, - L = v.rating < 0 || v.purged || v.deleted || (v.__minPatch && g_getPatchVersion.T[v.__minPatch] > u), - F = d || v.user.toLowerCase() == g_user.name.toLowerCase(), - y = F && v.deleted == 0, - c = F && v.replyTo != v.id, - M = ((v.roles & 26) == 0), - G = v.purged == 0 && v.deleted == 0 && g_user.id && v.user.toLowerCase() != g_user.name.toLowerCase() && $WH.in_array(v.raters, g_user.id, function(P) { - return P[0] - }) == -1, - i = v.rating >= 0 && (g_user.id == 0 || G); - v.ratable = G; - K.className = "comment"; - if (v.indent) { - K.className += " comment-indent" - } - var z = $WH.ce("div"); - var m = $WH.ce("div"); - var k = $WH.ce("div"); - v.divHeader = z; - v.divBody = m; - v.divLinks = k; - z.className = (L ? "comment-header-bt": "comment-header"); - var g = $WH.ce("div"); - g.className = "comment-rating"; - if (L) { - var q = $WH.ce("a"); - q.href = "javascript:;"; - q.onclick = Listview.funcBox.coToggleVis.bind(q, v); - $WH.ae(q, $WH.ct(LANG.lvcomment_show)); - $WH.ae(g, q); - $WH.ae(g, $WH.ct(" " + String.fromCharCode(160) + " ")) - } - var o = $WH.ce("b"); - $WH.ae(o, $WH.ct(LANG.lvcomment_rating)); - var r = $WH.ce("span"); - $WH.ae(r, $WH.ct((v.rating > 0 ? "+": "") + v.rating)); - $WH.ae(o, r); - $WH.ae(g, o); - $WH.ae(g, $WH.ct(" ")); - var E = $WH.ce("span"); - var j = $WH.ce("a"), - N = $WH.ce("a"); - if (G) { - j.href = N.href = "javascript:;"; - j.onclick = Listview.funcBox.coRate.bind(j, v, 1); - N.onclick = Listview.funcBox.coRate.bind(N, v, -1); - if (d) { - var D = $WH.ce("a"); - D.href = "javascript:;"; - D.onclick = Listview.funcBox.coRate.bind(D, v, 0); - D.onmouseover = Listview.funcBox.coCustomRatingOver; - D.onmousemove = Tooltip.cursorUpdate; - D.onmouseout = Tooltip.hide; - $WH.ae(D, $WH.ct("[~]")); - $WH.ae(E, D); - $WH.ae(E, $WH.ct(" ")) - } - } else { - j.href = N.href = "?account=signin" - } - $WH.ae(j, $WH.ct("[+]")); - j.onmouseover = Listview.funcBox.coPlusRatingOver; - N.onmouseover = Listview.funcBox.coMinusRatingOver; - j.onmousemove = N.onmousemove = Tooltip.cursorUpdate; - j.onmouseout = N.onmouseout = Tooltip.hide; - $WH.ae(N, $WH.ct("[-]")); - $WH.ae(E, N); - $WH.ae(E, $WH.ct(" ")); - $WH.ae(E, j); - $WH.ae(g, E); - if (!i) { - E.style.display = "none" - } - $WH.ae(z, g); - $WH.ae(z, $WH.ct(LANG.lvcomment_by)); - var J = $WH.ce("a"); - J.href = "?user=" + v.user; - $WH.ae(J, $WH.ct(v.user)); - $WH.ae(z, J); - $WH.ae(z, $WH.ct(" ")); - var a = $WH.ce("a"); - a.className = "q0"; - a.id = "comments:id=" + v.id; - a.href = "#" + a.id; - Listview.funcBox.coFormatDate(a, I, u); - a.style.cursor = "pointer"; - $WH.ae(z, a); - $WH.ae(z, $WH.ct($WH.sprintf(LANG.lvcomment_patch, g_getPatchVersion(u)))); - $WH.ae(K, z); - m.className = "comment-body" + Listview.funcBox.coGetColor(v); - if (v.indent) { - m.className += " comment-body-indent" - } - m.innerHTML = Markup.toHtml(v.body, { - mode: Markup.MODE_COMMENT, - roles: v.roles - }); - $WH.ae(K, m); - if ((v.roles & 26) == 0 || g_user.roles & 26) { - var H = $WH.ce("div"); - v.divLastEdit = H; - H.className = "comment-lastedit"; - $WH.ae(H, $WH.ct(LANG.lvcomment_lastedit)); - var p = $WH.ce("a"); - $WH.ae(p, $WH.ct(" ")); - $WH.ae(H, p); - $WH.ae(H, $WH.ct(" ")); - var C = $WH.ce("span"); - $WH.ae(H, C); - $WH.ae(H, $WH.ct(" ")); - Listview.funcBox.coUpdateLastEdit(v); - if (L) { - H.style.display = "none" - } - $WH.ae(K, H) - } - k.className = "comment-links"; - if (F) { - var b = $WH.ce("span"); - var B = $WH.ce("a"); - $WH.ae(B, $WH.ct(LANG.lvcomment_edit)); - B.onclick = Listview.funcBox.coEdit.bind(this, v, 0); - $WH.ns(B); - B.href = "javascript:;"; - $WH.ae(b, B); - $WH.ae(b, $WH.ct("|")); - $WH.ae(k, b) - } - if (y) { - var l = $WH.ce("span"); - var t = $WH.ce("a"); - $WH.ae(t, $WH.ct(LANG.lvcomment_delete)); - t.onclick = Listview.funcBox.coDelete.bind(this, v); - $WH.ns(t); - t.href = "javascript:;"; - $WH.ae(l, t); - $WH.ae(l, $WH.ct("|")); - $WH.ae(k, l) - } - if (c) { - var A = $WH.ce("span"); - var e = $WH.ce("a"); - $WH.ae(e, $WH.ct(LANG.lvcomment_detach)); - e.onclick = Listview.funcBox.coDetach.bind(this, v); - $WH.ns(e); - e.href = "javascript:;"; - $WH.ae(A, e); - $WH.ae(A, $WH.ct("|")); - $WH.ae(k, A) - } - if (M) { - var w = $WH.ce("span"); - var f = $WH.ce("a"); - $WH.ae(f, $WH.ct(LANG.lvcomment_report)); - if (g_user.id > 0) { - f.onclick = Listview.funcBox.coReportClick.bind(f, v, 0); - f.href = "javascript:;" - } else { - f.href = "?account=signin" - } - $WH.ae(w, f); - $WH.ae(w, $WH.ct("|")); - $WH.ae(k, w) - } - var h = $WH.ce("a"); - $WH.ae(h, $WH.ct(LANG.lvcomment_reply)); - if (g_user.id > 0) { - h.onclick = Listview.funcBox.coReply.bind(this, v); - h.href = "javascript:;" - } else { - h.href = "?account=signin" - } - $WH.ae(k, h); - if (L) { - m.style.display = "none"; - k.style.display = "none" - } - $WH.ae(K, k) - }, */ - createNote: function(b) { - var g = $WH.ce("small"); - if (!g_user.commentban) { - var l = $WH.ce("a"); - if (g_user.id > 0) { - l.href = "javascript:;"; - l.onclick = co_addYourComment - } else { - l.href = "?account=signin" - } - $WH.ae(l, $WH.ct(LANG.lvcomment_add)); - $WH.ae(g, l); - var e = $WH.ce("span"); - e.style.padding = "0 5px"; - e.style.color = "white"; - $WH.ae(e, $WH.ct("|")); - $WH.ae(g, e); - } - $WH.ae(g, $WH.ct(LANG.lvcomment_sort)); - var m = $WH.ce("a"); - m.href = "javascript:;"; - $WH.ae(m, $WH.ct(LANG.lvcomment_sortdate)); - m.onclick = Listview.funcBox.coSortDate.bind(this, m); - $WH.ae(g, m); - $WH.ae(g, $WH.ct(LANG.comma)); - var o = $WH.ce("a"); - o.href = "javascript:;"; - $WH.ae(o, $WH.ct(LANG.lvcomment_sortrating)); - o.onclick = Listview.funcBox.coSortHighestRatedFirst.bind(this, o); - $WH.ae(g, o); - var h = $WH.gc("temp_comment_sort") || 1; - if (h == "2") { - o.onclick() - } else { - m.onclick() - } - var e = $WH.ce("span"); - e.style.padding = "0 5px"; - e.style.color = "white"; - $WH.ae(e, $WH.ct("|")); - $WH.ae(g, e); - var q = $WH.ce("select"); - var f = $WH.ce("option"); - f.value = 0; - f.selected = "selected"; - $WH.ae(q, f); - var k = {}; - for (var i = 0; i < this.data.length; ++i) { - var h = new Date(this.data[i].date).getTime(); - k[g_getPatchVersionIndex(h)] = true - } - var j = []; - for (var c in k) { - j.push(c) - } - j.sort(function(p, d) { - return d - p - }); - for (var c = 0; c < j.length; ++c) { - var f = $WH.ce("option"); - f.value = j[c]; - $WH.ae(f, $WH.ct(g_getPatchVersion.V[j[c]])); - $WH.ae(q, f) - } - q.onchange = Listview.funcBox.coFilterByPatchVersion.bind(this, q); - $WH.ae(g, $WH.ct(LANG.lvcomment_patchfilter)); - $WH.ae(g, q); - $WH.ae(b, g); - }, - onNoData: function(c) { - var a = "" + LANG.lvnodata_co1 + '
    '; - if (g_user.id > 0) { - var b = LANG.lvnodata_co2; - b = b.replace("", ''); - a += b - } else { - var b = LANG.lvnodata_co3; + compute: function(v, K) { + var O, u = new Date(v.date), + I = (g_serverTime - u) / 1000, + d = (g_user.roles & 26) != 0, + L = v.rating < 0 || v.purged || v.deleted || (v.__minPatch && g_getPatchVersion.T[v.__minPatch] > u), + F = d || v.user.toLowerCase() == g_user.name.toLowerCase(), + y = F && v.deleted == 0, + c = F && v.replyTo != v.id, + M = ((v.roles & 26) == 0), + G = v.purged == 0 && v.deleted == 0 && g_user.id && v.user.toLowerCase() != g_user.name.toLowerCase() && $WH.in_array(v.raters, g_user.id, function(P) { + return P[0] + }) == -1, + i = v.rating >= 0 && (g_user.id == 0 || G); + v.ratable = G; + K.className = "comment"; + if (v.indent) { + K.className += " comment-indent" + } + var z = $WH.ce("div"); + var m = $WH.ce("div"); + var k = $WH.ce("div"); + v.divHeader = z; + v.divBody = m; + v.divLinks = k; + z.className = (L ? "comment-header-bt": "comment-header"); + var g = $WH.ce("div"); + g.className = "comment-rating"; + if (L) { + var q = $WH.ce("a"); + q.href = "javascript:;"; + q.onclick = Listview.funcBox.coToggleVis.bind(q, v); + $WH.ae(q, $WH.ct(LANG.lvcomment_show)); + $WH.ae(g, q); + $WH.ae(g, $WH.ct(" " + String.fromCharCode(160) + " ")) + } + var o = $WH.ce("b"); + $WH.ae(o, $WH.ct(LANG.lvcomment_rating)); + var r = $WH.ce("span"); + $WH.ae(r, $WH.ct((v.rating > 0 ? "+": "") + v.rating)); + $WH.ae(o, r); + $WH.ae(g, o); + $WH.ae(g, $WH.ct(" ")); + var E = $WH.ce("span"); + var j = $WH.ce("a"), + N = $WH.ce("a"); + if (G) { + j.href = N.href = "javascript:;"; + j.onclick = Listview.funcBox.coRate.bind(j, v, 1); + N.onclick = Listview.funcBox.coRate.bind(N, v, -1); + if (d) { + var D = $WH.ce("a"); + D.href = "javascript:;"; + D.onclick = Listview.funcBox.coRate.bind(D, v, 0); + D.onmouseover = Listview.funcBox.coCustomRatingOver; + D.onmousemove = $WH.Tooltip.cursorUpdate; + D.onmouseout = $WH.Tooltip.hide; + $WH.ae(D, $WH.ct("[~]")); + $WH.ae(E, D); + $WH.ae(E, $WH.ct(" ")) + } + } else { + j.href = N.href = "?account=signin" + } + $WH.ae(j, $WH.ct("[+]")); + j.onmouseover = Listview.funcBox.coPlusRatingOver; + N.onmouseover = Listview.funcBox.coMinusRatingOver; + j.onmousemove = N.onmousemove = $WH.Tooltip.cursorUpdate; + j.onmouseout = N.onmouseout = $WH.Tooltip.hide; + $WH.ae(N, $WH.ct("[-]")); + $WH.ae(E, N); + $WH.ae(E, $WH.ct(" ")); + $WH.ae(E, j); + $WH.ae(g, E); + if (!i) { + E.style.display = "none" + } + $WH.ae(z, g); + $WH.ae(z, $WH.ct(LANG.lvcomment_by)); + var J = $WH.ce("a"); + J.href = "?user=" + v.user; + $WH.ae(J, $WH.ct(v.user)); + $WH.ae(z, J); + $WH.ae(z, $WH.ct(" ")); + var a = $WH.ce("a"); + a.className = "q0"; + a.id = "comments:id=" + v.id; + a.href = "#" + a.id; + Listview.funcBox.coFormatDate(a, I, u); + a.style.cursor = "pointer"; + $WH.ae(z, a); + $WH.ae(z, $WH.ct($WH.sprintf(LANG.lvcomment_patch, g_getPatchVersion(u)))); + $WH.ae(K, z); + m.className = "comment-body" + Listview.funcBox.coGetColor(v); + if (v.indent) { + m.className += " comment-body-indent" + } + m.innerHTML = Markup.toHtml(v.body, { + mode: Markup.MODE_COMMENT, + roles: v.roles + }); + $WH.ae(K, m); + if ((v.roles & 26) == 0 || g_user.roles & 26) { + var H = $WH.ce("div"); + v.divLastEdit = H; + H.className = "comment-lastedit"; + $WH.ae(H, $WH.ct(LANG.lvcomment_lastedit)); + var p = $WH.ce("a"); + $WH.ae(p, $WH.ct(" ")); + $WH.ae(H, p); + $WH.ae(H, $WH.ct(" ")); + var C = $WH.ce("span"); + $WH.ae(H, C); + $WH.ae(H, $WH.ct(" ")); + Listview.funcBox.coUpdateLastEdit(v); + if (L) { + H.style.display = "none" + } + $WH.ae(K, H) + } + k.className = "comment-links"; + if (F) { + var b = $WH.ce("span"); + var B = $WH.ce("a"); + $WH.ae(B, $WH.ct(LANG.lvcomment_edit)); + B.onclick = Listview.funcBox.coEdit.bind(this, v, 0); + $WH.ns(B); + B.href = "javascript:;"; + $WH.ae(b, B); + $WH.ae(b, $WH.ct("|")); + $WH.ae(k, b) + } + if (y) { + var l = $WH.ce("span"); + var t = $WH.ce("a"); + $WH.ae(t, $WH.ct(LANG.lvcomment_delete)); + t.onclick = Listview.funcBox.coDelete.bind(this, v); + $WH.ns(t); + t.href = "javascript:;"; + $WH.ae(l, t); + $WH.ae(l, $WH.ct("|")); + $WH.ae(k, l) + } + if (c) { + var A = $WH.ce("span"); + var e = $WH.ce("a"); + $WH.ae(e, $WH.ct(LANG.lvcomment_detach)); + e.onclick = Listview.funcBox.coDetach.bind(this, v); + $WH.ns(e); + e.href = "javascript:;"; + $WH.ae(A, e); + $WH.ae(A, $WH.ct("|")); + $WH.ae(k, A) + } + if (M) { + var w = $WH.ce("span"); + var f = $WH.ce("a"); + $WH.ae(f, $WH.ct(LANG.lvcomment_report)); + if (g_user.id > 0) { + f.onclick = Listview.funcBox.coReportClick.bind(f, v, 0); + f.href = "javascript:;" + } else { + f.href = "?account=signin" + } + $WH.ae(w, f); + $WH.ae(w, $WH.ct("|")); + $WH.ae(k, w) + } + var h = $WH.ce("a"); + $WH.ae(h, $WH.ct(LANG.lvcomment_reply)); + if (g_user.id > 0) { + h.onclick = Listview.funcBox.coReply.bind(this, v); + h.href = "javascript:;" + } else { + h.href = "?account=signin" + } + $WH.ae(k, h); + if (L) { + m.style.display = "none"; + k.style.display = "none" + } + $WH.ae(K, k) + }, */ + createNote: function(b) { + var g = $WH.ce("small"); + if (!g_user.commentban) { + var l = $WH.ce("a"); + if (g_user.id > 0) { + l.href = "javascript:;"; + l.onclick = co_addYourComment + } else { + l.href = "?account=signin" + } + $WH.ae(l, $WH.ct(LANG.lvcomment_add)); + $WH.ae(g, l); + var e = $WH.ce("span"); + e.style.padding = "0 5px"; + e.style.color = "white"; + $WH.ae(e, $WH.ct("|")); + $WH.ae(g, e); + } + $WH.ae(g, $WH.ct(LANG.lvcomment_sort)); + var m = $WH.ce("a"); + m.href = "javascript:;"; + $WH.ae(m, $WH.ct(LANG.lvcomment_sortdate)); + m.onclick = Listview.funcBox.coSortDate.bind(this, m); + $WH.ae(g, m); + $WH.ae(g, $WH.ct(LANG.comma)); + var o = $WH.ce("a"); + o.href = "javascript:;"; + $WH.ae(o, $WH.ct(LANG.lvcomment_sortrating)); + o.onclick = Listview.funcBox.coSortHighestRatedFirst.bind(this, o); + $WH.ae(g, o); + var h = $WH.gc("temp_comment_sort") || 1; + if (h == "2") { + o.onclick() + } else { + m.onclick() + } + var e = $WH.ce("span"); + e.style.padding = "0 5px"; + e.style.color = "white"; + $WH.ae(e, $WH.ct("|")); + $WH.ae(g, e); + var q = $WH.ce("select"); + var f = $WH.ce("option"); + f.value = 0; + f.selected = "selected"; + $WH.ae(q, f); + var k = {}; + for (var i = 0; i < this.data.length; ++i) { + var h = new Date(this.data[i].date).getTime(); + k[g_getPatchVersionIndex(h)] = true + } + var j = []; + for (var c in k) { + j.push(c) + } + j.sort(function(p, d) { + return d - p + }); + for (var c = 0; c < j.length; ++c) { + var f = $WH.ce("option"); + f.value = j[c]; + $WH.ae(f, $WH.ct(g_getPatchVersion.V[j[c]])); + $WH.ae(q, f) + } + q.onchange = Listview.funcBox.coFilterByPatchVersion.bind(this, q); + $WH.ae(g, $WH.ct(LANG.lvcomment_patchfilter)); + $WH.ae(g, q); + $WH.ae(b, g); + }, + onNoData: function(c) { + var a = "" + LANG.lvnodata_co1 + '
    '; + if (g_user.id > 0) { + var b = LANG.lvnodata_co2; + b = b.replace("
    ", ''); + a += b + } else { + var b = LANG.lvnodata_co3; b = b.replace("", ''); b = b.replace("", ''); - a += b - } - c.style.padding = "1.5em 0"; - c.innerHTML = a - }, - onBeforeCreate: function() { - if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { - var a = $WH.in_array(this.data, parseInt(RegExp.$1), function(b) { - return b.id - }); - this.rowOffset = this.getRowOffset(a); - return this.data[a] - } - }, - onAfterCreate: function(a) { - if (a != null) { - var b = a.__div; - this.tabs.__st = b; - b.firstChild.style.border = "1px solid #505050" - } - } - }, - commentpreview: { - sort: [4], - nItemsPerPage: 75, - columns: [{ - id: "subject", - name: LANG.subject, - align: "left", - value: "subject", - compute: function(f, e) { - var b = $WH.ce("a"); - b.style.fontFamily = "Verdana, sans-serif"; - b.href = this.template.getItemLink(f); - $WH.ae(b, $WH.ct(f.subject)); - $WH.ae(e, b); - if (LANG.types[f.type]) { - var c = $WH.ce("div"); - c.className = "small"; - $WH.ae(c, $WH.ct(LANG.types[f.type][0])); - $WH.ae(e, c) - } - } - }, - { - id: "preview", - name: LANG.preview, - align: "left", - width: "50%", - value: "preview", - compute: function(j, i, k) { - var g = $WH.ce("div"); - g.className = "crop"; - if (j.rating >= 10) { - g.className += " comment-green" - } - $WH.ae(g, $WH.ct(Markup.removeTags(j.preview, { - mode: Markup.MODE_ARTICLE - }))); - $WH.ae(i, g); - var e = j.rating != null; - var f = j.user != null; - if (e || f ||j.purged) { - g = $WH.ce("div"); - g.className = "small3"; - if (f) { - $WH.ae(g, $WH.ct(LANG.lvcomment_by)); - var b = $WH.ce("a"); - b.href = "?user=" + j.user; - $WH.ae(b, $WH.ct(j.user)); - $WH.ae(g, b); - if (e) { - $WH.ae(g, $WH.ct(LANG.hyphen)) - } - } - if (e) { - $WH.ae(g, $WH.ct(LANG.lvcomment_rating + (j.rating > 0 ? "+": "") + j.rating)); - var c = $WH.ce("span"), - h = ""; - c.className = "q10"; - if (j.deleted) { - h = LANG.lvcomment_deleted - } else { - if (j.purged) { - h = LANG.lvcomment_purged - } - } - $WH.ae(c, $WH.ct(h)); - $WH.ae(g, c) - k.__status = c; - } - $WH.ae(i, g) - } + a += b } - }, - { - id: "author", - name: LANG.author, - value: "user", - compute: function(d, c) { - c.className = "q1"; - var b = $WH.ce("a"); - b.href = "?user=" + d.user; - $WH.ae(b, $WH.ct(d.user)); - $WH.ae(c, b) - } - }, - { - id: "posted", - name: LANG.posted, - width: "16%", - value: "elapsed", - compute: function(e, d) { - var a = new Date(e.date), - c = (g_serverTime - a) / 1000; - var b = $WH.ce("span"); - Listview.funcBox.coFormatDate(b, c, a, 0, 1); - $WH.ae(d, b) - } - }], - getItemLink: function(a) { - return "?" + g_types[a.type] + "=" + a.typeId + (a.id != null ? "#comments:id=" + a.id: "") - } - }, - screenshot: { - sort: [], - mode: 3, - nItemsPerPage: 40, - nItemsPerRow: 4, - poundable: 2, - columns: [], - compute: function(k, e, l) { - var v, p = new Date(k.date), - f = (g_serverTime - p) / 1000; - e.className = "screenshot-cell"; - e.vAlign = "bottom"; - var r = $WH.ce("a"); - r.href = "#screenshots:id=" + k.id; - r.onclick = $WH.rf2; - var w = $WH.ce("img"), - u = Math.min(150 / k.width, 150 / k.height); - // w.src = "http://static.wowhead.com/uploads/screenshots/thumb/" + k.id + ".jpg"; - w.src = g_staticUrl + "/uploads/screenshots/thumb/" + k.id + ".jpg"; - $WH.ae(r, w); - $WH.ae(e, r); - var q = $WH.ce("div"); - q.className = "screenshot-cell-user"; - var m = (k.user != null && k.user.length); - if (m) { - r = $WH.ce("a"); - r.href = "?user=" + k.user; - $WH.ae(r, $WH.ct(k.user)); - $WH.ae(q, $WH.ct(LANG.lvscreenshot_from)); - $WH.ae(q, r); - $WH.ae(q, $WH.ct(" ")) - } - var j = $WH.ce("span"); - if (m) { - Listview.funcBox.coFormatDate(j, f, p) - } else { - Listview.funcBox.coFormatDate(j, f, p, 0, 1) - } - $WH.ae(q, j); + c.style.padding = "1.5em 0"; + c.innerHTML = a + }, + onBeforeCreate: function() { + if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { + var a = $WH.in_array(this.data, parseInt(RegExp.$1), function(b) { + return b.id + }); + this.rowOffset = this.getRowOffset(a); + return this.data[a] + } + }, + onAfterCreate: function(a) { + if (a != null) { + var b = a.__div; + this.tabs.__st = b; + b.firstChild.style.border = "1px solid #505050" + } + } + }, - $WH.ae(q, $WH.ct(" " + LANG.dash + " ")); - var w = $WH.ce("a"); - w.href = "javascript:;"; - w.onclick = ContactTool.show.bind(ContactTool, { - mode: 3, - screenshot: k - }); - w.className = "report-icon" - g_addTooltip(w, LANG.report_tooltip, "q2"); - $WH.ae(w, $WH.ct(LANG.report)); - $WH.ae(q, w); + commentpreview: { + sort: [4], + nItemsPerPage: 75, - $WH.ae(e, q); - q = $WH.ce("div"); - q.style.position = "relative"; - q.style.height = "1em"; - if (g_getLocale(true) != 0 && k.caption) { - k.caption = "" - } - var h = (k.caption != null && k.caption.length); - var g = (k.subject != null && k.subject.length); - if (h || g) { - var t = $WH.ce("div"); - t.className = "screenshot-caption"; - if (g) { - var c = $WH.ce("small"); - $WH.ae(c, $WH.ct(LANG.types[k.type][0] + LANG.colon)); - var b = $WH.ce("a"); - $WH.ae(b, $WH.ct(k.subject)); - b.href = "?" + g_types[k.type] + "=" + k.typeId; - $WH.ae(c, b); - $WH.ae(t, c); - if (h && k.caption.length) { - $WH.ae(c, $WH.ct(" (...)")) - } - $WH.ae(c, $WH.ce("br")) - } - if (h) { - $WH.aE(e, "mouseover", Listview.funcBox.ssCellOver.bind(t)); - $WH.aE(e, "mouseout", Listview.funcBox.ssCellOut.bind(t)); - var o = $WH.ce("span"); - o.innerHTML = Markup.toHtml(k.caption, { - mode: Markup.MODE_SIGNATURE - }); - $WH.ae(t, o) - } - $WH.ae(q, t) - } - $WH.aE(e, "click", Listview.funcBox.ssCellClick.bind(this, l)); - $WH.ae(e, q) - }, - createNote: function(d) { - if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) { - var c = $WH.ce("small"); - var b = $WH.ce("a"); - if (g_user.id > 0) { - b.href = "javascript:;"; - b.onclick = ss_submitAScreenshot - } else { - b.href = "?account=signin" - } - $WH.ae(b, $WH.ct(LANG.lvscreenshot_submit)); - $WH.ae(c, b); - $WH.ae(d, c) - } - }, - onNoData: function(c) { - if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) { - var a = "" + LANG.lvnodata_ss1 + '
    '; - if (g_user.id > 0) { - var b = LANG.lvnodata_ss2; - b = b.replace("
    ", ''); - a += b - } else { - var b = LANG.lvnodata_ss3; - b = b.replace("", ''); - b = b.replace("", ''); - a += b - } - c.style.padding = "1.5em 0"; - c.innerHTML = a - } else { - return -1 - } - }, - onBeforeCreate: function() { - if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { - var a = $WH.in_array(this.data, parseInt(RegExp.$1), function(b) { - return b.id - }); - this.rowOffset = this.getRowOffset(a); - return a - } - }, - onAfterCreate: function(a) { - if (a != null) { - setTimeout((function() { - ScreenshotViewer.show({ - screenshots: this.data, - pos: a - }) - }).bind(this), 1) - } - } - }, - video: { - sort: [], - mode: 3, - nItemsPerPage: 40, - nItemsPerRow: 4, - poundable: 2, - columns: [], - compute: function(e, f, j) { - var q, k = new Date(e.date), - r = (g_serverTime - k) / 1000; - f.className = "screenshot-cell"; - f.vAlign = "bottom"; - var p = $WH.ce("a"); - p.href = "#videos:id=" + e.id; - p.onclick = $WH.rf2; - var h = $WH.ce("img"); - h.src = $WH.sprintf(vi_thumbnails[e.videoType], e.videoId); - $WH.ae(p, h); - $WH.ae(f, p); - var l = $WH.ce("div"); - l.className = "screenshot-cell-user"; - var t = (e.user != null && e.user.length); - if (t) { - p = $WH.ce("a"); - p.href = "?user=" + e.user; - $WH.ae(p, $WH.ct(e.user)); - $WH.ae(l, $WH.ct(LANG.lvvideo_from)); - $WH.ae(l, p); - $WH.ae(l, $WH.ct(" ")) - } - var u = $WH.ce("span"); - if (t) { - Listview.funcBox.coFormatDate(u, r, k) - } else { - Listview.funcBox.coFormatDate(u, r, k, 0, 1) - } - $WH.ae(l, u); - $WH.ae(f, l); - l = $WH.ce("div"); - l.style.position = "relative"; - l.style.height = "1em"; - if (g_locale.id != 0 && e.caption) { - e.caption = "" - } - var c = (e.caption != null && e.caption.length); - var g = (e.subject != null && e.subject.length); - if (c || g) { - var b = $WH.ce("div"); - b.className = "screenshot-caption"; - if (g) { - var o = $WH.ce("small"); - $WH.ae(o, $WH.ct(LANG.types[e.type][0] + LANG.colon)); - var n = $WH.ce("a"); - $WH.ae(n, $WH.ct(e.subject)); - n.href = g_getCommentDomain(e.domain) + "/" + g_types[e.type] + "=" + e.typeId; - $WH.ae(o, n); - $WH.ae(b, o); - if (c && e.caption.length) { - $WH.ae(o, $WH.ct(" (...)")) - } - $WH.ae(o, $WH.ce("br")) - } - if (c) { - $WH.aE(f, "mouseover", Listview.funcBox.ssCellOver.bind(b)); - $WH.aE(f, "mouseout", Listview.funcBox.ssCellOut.bind(b)); - var m = $WH.ce("span"); - m.innerHTML = Markup.toHtml(e.caption, { - mode: Markup.MODE_SIGNATURE - }); - $WH.ae(b, m) - } - $WH.ae(l, b) - } - $WH.aE(f, "click", Listview.funcBox.viCellClick.bind(this, j)); - $WH.ae(f, l) - }, - createNote: function(d) { - if (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)) { - if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) { - var c = $WH.ce("small"); - var b = $WH.ce("a"); - if (g_user.id > 0) { - b.href = "javascript:;"; - b.onclick = vi_submitAVideo - } else { - b.href = "?account=signin" - } - $WH.ae(b, $WH.ct(LANG.lvvideo_suggest)); - $WH.ae(c, b); - $WH.ae(d, c) - } - } - }, - onNoData: function(c) { - if (typeof g_pageInfo == "object" && g_pageInfo.type > 0) { - var a = "" + LANG.lvnodata_vi1 + '
    '; - if (g_user.id > 0) { - var b = LANG.lvnodata_vi2; - b = b.replace("
    ", ''); - a += b - } else { - var b = LANG.lvnodata_vi3; - b = b.replace("", ''); - b = b.replace("", ''); - a += b - } - c.style.padding = "1.5em 0"; - c.innerHTML = a - } else { - return - 1 - } - }, - onBeforeCreate: function() { - if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { - var a = $WH.in_array(this.data, parseInt(RegExp.$1), function(b) { - return b.id - }); - this.rowOffset = this.getRowOffset(a); - return a - } - }, - onAfterCreate: function(a) { - if (a != null) { - setTimeout((function() { - VideoViewer.show({ - videos: this.data, - pos: a, - displayAd: true - }) - }).bind(this), 1) - } - } - }, + columns: [ + { + id: 'subject', + name: LANG.subject, + align: 'left', + value: 'subject', + compute: function(comment, td) { + var a = $WH.ce('a'); + a.style.fontFamily = 'Verdana, sans-serif'; + a.href = this.getItemLink(comment); + $WH.ae(a, $WH.ct(comment.subject)); + $WH.ae(td, a); + + if (LANG.types[comment.type]) { + var d = $WH.ce('div'); + d.className = 'small'; + $WH.ae(d, $WH.ct(LANG.types[comment.type][0])); + $WH.ae(td, d); + } + } + }, + { + id: 'preview', + name: LANG.preview, + align: 'left', + width: '50%', + value: 'preview', + compute: function(comment, td, tr) { + var d = $WH.ce('div'); + d.className = 'crop'; + if (comment.rating >= 10) { + d.className += ' comment-green'; + } + + $WH.ae(d, $WH.ct( + Markup.removeTags(comment.preview, {mode: Markup.MODE_ARTICLE}) + )); + $WH.ae(td, d); + + if (comment.rating || comment.deleted) { + d = $WH.ce('div'); + d.className = 'small3'; + + if (comment.rating) { + $WH.ae(d, $WH.ct(LANG.lvcomment_rating + (comment.rating > 0 ? '+': '') + comment.rating)); + } + + var + s = $WH.ce('span'), + foo = ''; + + s.className = 'q10'; + if (comment.deleted) { + foo = LANG.lvcomment_deleted; + } + + $WH.ae(s, $WH.ct(foo)); + $WH.ae(d, s); + + tr.__status = s; + + $WH.ae(td, d); + } + } + }, + { + id: 'author', + name: LANG.author, + value: 'user', + compute: function(comment, td) { + td.className = 'q1'; + + var a = $WH.ce('a'); + a.href = '?user=' + comment.user; + $WH.ae(a, $WH.ct(comment.user)); + $WH.ae(td, a); + } + }, + { + id: 'posted', + name: LANG.posted, + width: '16%', + value: 'elapsed', + compute: function(comment, td) { + var + postedOn = new Date(comment.date), + elapsed = (g_serverTime - postedOn) / 1000; + + var s = $WH.ce('span'); + g_formatDate(s, elapsed, postedOn, 0, 1); + $WH.ae(td, s); + } + } + ], + + getItemLink: function(comment) { + return '?' + g_types[comment.type] + '=' + comment.typeId + (comment.id != null ? '#comments:id=' + comment.id: '') + } + }, + + screenshot: { + sort: [], + mode: 3, // Grid mode + nItemsPerPage: 40, + nItemsPerRow: 4, + poundable: 2, // Yes but w/o sort + + columns: [], + + compute: function(screenshot, td, i) { + var + _, + postedOn = new Date(screenshot.date), + elapsed = (g_serverTime - postedOn) / 1000; + + td.className = 'screenshot-cell'; + td.vAlign = 'bottom'; + + var a = $WH.ce('a'); + a.href = '#screenshots:id=' + screenshot.id; + a.onclick = $WH.rf2; + + var + img = $WH.ce('img'), + scale = Math.min(150 / screenshot.width, 150 / screenshot.height); + + img.src = g_staticUrl + '/uploads/screenshots/thumb/' + screenshot.id + '.jpg'; + //img.width = Math.round(scale * screenshot.width); + //img.height = Math.round(scale * screenshot.height); + $WH.ae(a, img); + + $WH.ae(td, a); + + var d = $WH.ce('div'); + d.className = 'screenshot-cell-user'; + + var hasUser = (screenshot.user != null && screenshot.user.length); + + if (hasUser) { + a = $WH.ce('a'); + a.href = '?user=' + screenshot.user; + $WH.ae(a, $WH.ct(screenshot.user)); + $WH.ae(d, $WH.ct(LANG.lvscreenshot_from)); + $WH.ae(d, a); + $WH.ae(d, $WH.ct(' ')); + } + + var s = $WH.ce('span'); + if (hasUser) { + g_formatDate(s, elapsed, postedOn); + } + else { + g_formatDate(s, elapsed, postedOn, 0, 1); + } + $WH.ae(d, s); + + $WH.ae(d, $WH.ct(' ' + LANG.dash + ' ')); + var a = $WH.ce('a'); + a.href = 'javascript:;'; + a.onclick = ContactTool.show.bind(ContactTool, { + mode: 3, + screenshot: screenshot + }); + + a.className = 'report-icon'; + + g_addTooltip(a, LANG.report_tooltip, 'q2'); + $WH.ae(a, $WH.ct(LANG.report)); + $WH.ae(d, a); + + $WH.ae(td, d); + + d = $WH.ce('div'); + d.style.position = 'relative'; + d.style.height = '1em'; + + var hasCaption = (screenshot.caption != null && screenshot.caption.length); + var hasSubject = (screenshot.subject != null && screenshot.subject.length); + + if (hasCaption || hasSubject) { + var d2 = $WH.ce('div'); + d2.className = 'screenshot-caption'; + + if (hasSubject) { + var foo1 = $WH.ce('small'); + $WH.ae(foo1, $WH.ct(LANG.types[screenshot.type][0] + LANG.colon)); + var foo2 = $WH.ce('a'); + $WH.ae(foo2, $WH.ct(screenshot.subject)); + foo2.href = '?' + g_types[screenshot.type] + '=' + screenshot.typeId; + $WH.ae(foo1, foo2); + $WH.ae(d2, foo1); + + if (hasCaption && screenshot.caption.length) { + $WH.ae(foo1, $WH.ct(' (...)')); + } + $WH.ae(foo1, $WH.ce('br')); + } + + if (hasCaption) { + $WH.aE(td, 'mouseover', Listview.funcBox.ssCellOver.bind(d2)); + $WH.aE(td, 'mouseout', Listview.funcBox.ssCellOut.bind(d2)); + + var foo = $WH.ce('span'); + foo.innerHTML = Markup.toHtml(screenshot.caption, { + mode: Markup.MODE_SIGNATURE + }); + $WH.ae(d2, foo); + } + + $WH.ae(d, d2); + } + + $WH.aE(td, 'click', Listview.funcBox.ssCellClick.bind(this, i)); + + $WH.ae(td, d); + }, + + createNote: function(div) { + if (typeof g_pageInfo == 'object' && g_pageInfo.type > 0) { + var sm = $WH.ce('small'); + + var a = $WH.ce('a'); + if (g_user.id > 0) { + a.href = 'javascript:;'; + a.onclick = ss_submitAScreenshot; + } + else { + a.href = '?account=signin'; + } + $WH.ae(a, $WH.ct(LANG.lvscreenshot_submit)); + $WH.ae(sm, a); + + $WH.ae(div, sm); + } + }, + + onNoData: function(div) { + if (typeof g_pageInfo == 'object' && g_pageInfo.type > 0) { + var s = '' + LANG.lvnodata_ss1 + '
    '; + + if (g_user.id > 0) { + var foo = LANG.lvnodata_ss2; + foo = foo.replace('
    ', ''); + s += foo; + } + else { + var foo = LANG.lvnodata_ss3; + foo = foo.replace('', ''); + foo = foo.replace('', ''); + s += foo; + } + + div.style.padding = '1.5em 0'; + div.innerHTML = s; + } + else { + return -1; + } + }, + + onBeforeCreate: function() { + if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { + var rowNo = $WH.in_array(this.data, parseInt(RegExp.$1), function(x) { + return x.id; + }); + this.rowOffset = this.getRowOffset(rowNo); + return rowNo; + } + }, + + onAfterCreate: function(rowNo) { + if (rowNo != null) { + setTimeout((function() { + ScreenshotViewer.show({ + screenshots: this.data, + pos: rowNo + }) + }).bind(this), 1); + } + } + }, + + video: { + sort: [], + mode: 3, // Grid mode + nItemsPerPage: 40, + nItemsPerRow: 4, + poundable: 2, // Yes but w/o sort + + columns: [], + + compute: function(video, td, i) { + var + _, + postedOn = new Date(video.date), + elapsed = (g_serverTime - postedOn) / 1000; + + td.className = 'screenshot-cell'; + td.vAlign = 'bottom'; + + var a = $WH.ce('a'); + a.href = '#videos:id=' + video.id; + a.onclick = $WH.rf2; + + var img = $WH.ce('img'); + img.src = $WH.sprintf(vi_thumbnails[video.videoType], video.videoId); + $WH.ae(a, img); + + $WH.ae(td, a); + + var d = $WH.ce('div'); + d.className = 'screenshot-cell-user'; + + var hasUser = (video.user != null && video.user.length); + + if (hasUser) { + a = $WH.ce('a'); + a.href = '?user=' + video.user; + $WH.ae(a, $WH.ct(video.user)); + $WH.ae(d, $WH.ct(LANG.lvvideo_from)); + $WH.ae(d, a); + $WH.ae(d, $WH.ct(' ')); + } + + var s = $WH.ce('span'); + if (hasUser) { + g_formatDate(s, elapsed, postedOn); + } + else { + g_formatDate(s, elapsed, postedOn, 0, 1); + } + $WH.ae(d, s); + + $WH.ae(d, $WH.ct(' ' + LANG.dash + ' ')); + var a = $WH.ce('a'); + a.href = 'javascript:;'; + a.onclick = ContactTool.show.bind(ContactTool, {mode: 5, video: video}); + a.className = 'icon-report'; + g_addTooltip(a, LANG.report_tooltip, 'q2'); + $WH.ae(a, $WH.ct(LANG.report)); + $WH.ae(d, a); + + $WH.ae(td, d); + + d = $WH.ce('div'); + d.style.position = 'relative'; + d.style.height = '1em'; + var hasCaption = (video.caption != null && video.caption.length); + var hasSubject = (video.subject != null && video.subject.length); + + if (hasCaption || hasSubject) { + var d2 = $WH.ce('div'); + d2.className = 'screenshot-caption'; + + if (hasSubject) { + var foo1 = $WH.ce('small'); + $WH.ae(foo1, $WH.ct(LANG.types[video.type][0] + LANG.colon)); + var foo2 = $WH.ce('a'); + $WH.ae(foo2, $WH.ct(video.subject)); + foo2.href = '?' + g_types[video.type] + '=' + video.typeId; + $WH.ae(foo1, foo2); + $WH.ae(d2, foo1); + + if (hasCaption && video.caption.length) { + $WH.ae(foo1, $WH.ct(' (...)')); + } + $WH.ae(foo1, $WH.ce('br')); + } + + if (hasCaption) { + $WH.aE(td, 'mouseover', Listview.funcBox.ssCellOver.bind(d2)); + $WH.aE(td, 'mouseout', Listview.funcBox.ssCellOut.bind(d2)); + + var foo = $WH.ce('span'); + foo.innerHTML = Markup.toHtml(video.caption, { + mode: Markup.MODE_SIGNATURE + }); + $WH.ae(d2, foo); + } + + $WH.ae(d, d2); + } + + $WH.aE(td, 'click', Listview.funcBox.viCellClick.bind(this, i)); + + $WH.ae(td, d); + }, + + createNote: function(div) { + if (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)) { + if (typeof g_pageInfo == 'object' && g_pageInfo.type > 0) { + var sm = $WH.ce('small'); + + var a = $WH.ce('a'); + if (g_user.id > 0) { + a.href = 'javascript:;'; + a.onclick = vi_submitAVideo; + } + else { + a.href = '?account=signin'; + } + + $WH.ae(a, $WH.ct(LANG.lvvideo_suggest)); + $WH.ae(sm, a); + + $WH.ae(div, sm); + } + } + }, + + onNoData: function(div) { + if (typeof g_pageInfo == 'object' && g_pageInfo.type > 0) { + var s = '' + LANG.lvnodata_vi1 + '
    '; + + if (g_user.id > 0) { + var foo = LANG.lvnodata_vi2; + foo = foo.replace('
    ', ''); + s += foo; + } + else { + var foo = LANG.lvnodata_vi3; + foo = foo.replace('', ''); + foo = foo.replace('', ''); + s += foo; + } + + div.style.padding = '1.5em 0'; + div.innerHTML = s; + } + else { + return -1; + } + }, + + onBeforeCreate: function() { + if (location.hash && location.hash.match(/:id=([0-9]+)/) != null) { + var rowNo = $WH.in_array(this.data, parseInt(RegExp.$1), function(x) { + return x.id; + }); + this.rowOffset = this.getRowOffset(rowNo); + return rowNo; + } + }, + + onAfterCreate: function(rowNo) { + if (rowNo != null) { + setTimeout((function() { + VideoViewer.show({ + videos: this.data, + pos: rowNo + }) + }).bind(this), 1); + } + } + }, pet: { sort: [1], @@ -10415,7 +11107,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(pet); + a.href = this.getItemLink(pet); $WH.ae(a, $WH.ct(pet.name)); if (pet.expansion) { @@ -10647,7 +11339,7 @@ Listview.templates = { $WH.ae(i, g_achievements.createIcon(achievement.id, 1)); - Icon.getLink(i.firstChild).href = this.template.getItemLink(achievement); + Icon.getLink(i.firstChild).href = this.getItemLink(achievement); Icon.getLink(i.firstChild).rel = rel; $WH.ae(tr, i); @@ -10655,7 +11347,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(achievement); + a.href = this.getItemLink(achievement); a.rel = rel; $WH.ae(a, $WH.ct(achievement.name)); $WH.ae(td, a); @@ -10909,7 +11601,7 @@ Listview.templates = { // $WH.nw(td) - sp.href = this.template.getItemLink(title); + sp.href = this.getItemLink(title); if (title.who) { $WH.ae(n, $WH.ct(title.who)); @@ -11124,7 +11816,7 @@ Listview.templates = { i.style.padding = '0'; i.style.borderRight = 'none'; - $WH.ae(i, Icon.create($WH.g_getProfileIcon(profile.race, profile.classs, profile.gender, profile.level, profile.icon ? profile.icon : profile.id, 'medium'), 1, null, this.template.getItemLink(profile))); + $WH.ae(i, Icon.create($WH.g_getProfileIcon(profile.race, profile.classs, profile.gender, profile.level, profile.icon ? profile.icon : profile.id, 'medium'), 1, null, this.getItemLink(profile))); $WH.ae(tr, i); td.style.borderLeft = 'none'; @@ -11138,7 +11830,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(profile); + a.href = this.getItemLink(profile); if (profile.pinned) { a.className = 'star-icon-right'; } @@ -11343,7 +12035,7 @@ Listview.templates = { a.className = 'icontiny tinyspecial tip q1'; a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + specData.icon.toLowerCase() + '.gif)'; a.rel = 'np'; - a.href = this.template.getItemLink(profile) + '#talents'; + a.href = this.getItemLink(profile) + '#talents'; g_addTooltip(a, specData.name); $WH.ae(a, $WH.ct(profile.talenttree1 + ' / ' + profile.talenttree2 + ' / ' + profile.talenttree3)); @@ -11631,7 +12323,7 @@ Listview.templates = { i.style.padding = '0'; i.style.borderRight = 'none'; - $WH.ae(i, Icon.create(currency.icon, 0, null, this.template.getItemLink(currency))); + $WH.ae(i, Icon.create(currency.icon, 0, null, this.getItemLink(currency))); $WH.ae(tr, i); td.style.borderLeft = 'none'; @@ -11639,7 +12331,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(currency); + a.href = this.getItemLink(currency); $WH.ae(a, $WH.ct(currency.name)); $WH.ae(wrapper, a); @@ -11693,7 +12385,7 @@ Listview.templates = { i.style.padding = '0'; i.style.borderRight = 'none'; - $WH.ae(i, Icon.create('class_' + g_file_classes[classs.id], 0, null, this.template.getItemLink(classs))); + $WH.ae(i, Icon.create('class_' + g_file_classes[classs.id], 0, null, this.getItemLink(classs))); $WH.ae(tr, i); td.style.borderLeft = 'none'; @@ -11705,7 +12397,7 @@ Listview.templates = { var a = $WH.ce('a'); a.className = 'c' + classs.id; a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(classs); + a.href = this.getItemLink(classs); $WH.ae(a, $WH.ct(classs.name)); if (classs.expansion) { @@ -11789,11 +12481,11 @@ Listview.templates = { d.style.textAlign = 'left'; d.style.width = '52px'; - icon = Icon.create('race_' + g_file_races[race.id] + '_' + g_file_genders[0], 0, null, this.template.getItemLink(race)); + icon = Icon.create('race_' + g_file_races[race.id] + '_' + g_file_genders[0], 0, null, this.getItemLink(race)); icon.style.cssFloat = icon.style.styleFloat = 'left'; $WH.ae(d, icon); - icon = Icon.create('race_' + g_file_races[race.id] + '_' + g_file_genders[1], 0, null, this.template.getItemLink(race)); + icon = Icon.create('race_' + g_file_races[race.id] + '_' + g_file_genders[1], 0, null, this.getItemLink(race)); icon.style.cssFloat = icon.style.styleFloat = 'left'; $WH.ae(d, icon); @@ -11810,7 +12502,7 @@ Listview.templates = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; - a.href = this.template.getItemLink(race); + a.href = this.getItemLink(race); $WH.ae(a, $WH.ct(race.name)); if (race.expansion) { @@ -13299,400 +13991,6 @@ var RedButton = { } }; -var Tooltip = { - create: function(htmlTooltip, secondary) { - var - d = $WH.ce('div'), - t = $WH.ce('table'), - tb = $WH.ce('tbody'), - tr1 = $WH.ce('tr'), - tr2 = $WH.ce('tr'), - td = $WH.ce('td'), - th1 = $WH.ce('th'), - th2 = $WH.ce('th'), - th3 = $WH.ce('th'); - - d.className = 'tooltip'; - - th1.style.backgroundPosition = 'top right'; - th2.style.backgroundPosition = 'bottom left'; - th3.style.backgroundPosition = 'bottom right'; - - if (htmlTooltip) { - td.innerHTML = htmlTooltip; - } - - $WH.ae(tr1, td); - $WH.ae(tr1, th1); - $WH.ae(tb, tr1); - $WH.ae(tr2, th2); - $WH.ae(tr2, th3); - $WH.ae(tb, tr2); - $WH.ae(t, tb); - - if (!secondary) { - Tooltip.icon = $WH.ce('p'); - Tooltip.icon.style.visibility = 'hidden'; - $WH.ae(Tooltip.icon, $WH.ce('div')); - $WH.ae(d, Tooltip.icon); - } - - $WH.ae(d, t); - - if (!secondary) { - var img = $WH.ce('div'); - img.className = 'tooltip-powered'; - $WH.ae(d, img); - Tooltip.logo = img; - } - - return d; - }, - - getMultiPartHtml: function(upper, lower) { - return '
    ' + upper + '
    ' + lower + '
    '; - }, - - fix: function(tooltip, noShrink, visible) { - var - table = $WH.gE(tooltip, 'table')[0], - td = $WH.gE(table, 'td')[0], - c = td.childNodes; - - if (c.length >= 2 && c[0].nodeName == 'TABLE' && c[1].nodeName == 'TABLE') { - c[0].style.whiteSpace = 'nowrap'; - - var m = parseInt(tooltip.style.width); - if (!m) { - if (c[1].offsetWidth > 300) { - m = Math.max(300, c[0].offsetWidth) + 20; - } - else { - m = Math.max(c[0].offsetWidth, c[1].offsetWidth) + 20; - } - } - - m = Math.min(320, m); - if (m > 20) { - tooltip.style.width = m + 'px'; - c[0].style.width = c[1].style.width = '100%'; - - if (!noShrink && tooltip.offsetHeight > document.body.clientHeight) { - table.className = 'shrink'; - } - } - } - - if (visible) { - tooltip.style.visibility = 'visible'; - } - }, - - fixSafe: function(p1, p2, p3) { - Tooltip.fix(p1, p2, p3); - }, - - append: function(el, htmlTooltip) { - var el = $(el); - var tooltip = Tooltip.create(htmlTooltip); - $WH.ae(el, tooltip); - - Tooltip.fixSafe(tooltip, 1, 1); - }, - - prepare: function() { - if (Tooltip.tooltip) { - return; - } - - var _ = Tooltip.create(); - _.style.position = 'absolute'; - _.style.left = _.style.top = '-2323px'; - - $WH.ae(document.body, _); - - Tooltip.tooltip = _; - Tooltip.tooltipTable = $WH.gE(_, 'table')[0]; - Tooltip.tooltipTd = $WH.gE(_, 'td')[0]; - - var _ = Tooltip.create(null, true); - _.style.position = 'absolute'; - _.style.left = _.style.top = '-2323px'; - - $WH.ae(document.body, _); - - Tooltip.tooltip2 = _; - Tooltip.tooltipTable2 = $WH.gE(_, 'table')[0]; - Tooltip.tooltipTd2 = $WH.gE(_, 'td')[0]; - }, - - set: function(text, text2) { - var _ = Tooltip.tooltip; - - _.style.width = '550px'; - _.style.left = '-2323px'; - _.style.top = '-2323px'; - - if (text.nodeName) { - $WH.ee(Tooltip.tooltipTd); - $WH.ae(Tooltip.tooltipTd, text); - } - else { - Tooltip.tooltipTd.innerHTML = text; - } - - _.style.display = ''; - - Tooltip.fix(_, 0, 0); - - if (text2) { - Tooltip.showSecondary = true; - var _ = Tooltip.tooltip2; - - _.style.width = '550px'; - _.style.left = '-2323px'; - _.style.top = '-2323px'; - - if (text2.nodeName) { - $WH.ee(Tooltip.tooltipTd2); - $WH.ae(Tooltip.tooltipTd2, text2); - } - else { - Tooltip.tooltipTd2.innerHTML = text2; - } - - _.style.display = ''; - - Tooltip.fix(_, 0, 0); - } - else { - Tooltip.showSecondary = false; - } - }, - - moveTests: [ - [null, null], // Top right - [null, false], // Bottom right - [false, null], // Top left - [false, false] // Bottom left - ], - - move: function(x, y, width, height, paddX, paddY) { - if (!Tooltip.tooltipTable) { - return; - } - - var - tooltip = Tooltip.tooltip, - tow = Tooltip.tooltipTable.offsetWidth, - toh = Tooltip.tooltipTable.offsetHeight, - tt2 = Tooltip.tooltip2, - tt2w = Tooltip.showSecondary ? Tooltip.tooltipTable2.offsetWidth : 0, - tt2h = Tooltip.showSecondary ? Tooltip.tooltipTable2.offsetHeight : 0, - _; - - tooltip.style.width = tow + 'px'; - tt2.style.width = tt2w + 'px'; - - var - rect, - safe; - - for (var i = 0, len = Tooltip.moveTests.length; i < len; ++i) { - _ = Tooltip.moveTests[i]; - - rect = Tooltip.moveTest(x, y, width, height, paddX, paddY, _[0], _[1]); - break; - } - - tooltip.style.left = rect.l + 'px'; - tooltip.style.top = rect.t + 'px'; - tooltip.style.visibility = 'visible'; - - if (Tooltip.showSecondary) { - tt2.style.left = rect.l + tow + 'px'; - tt2.style.top = rect.t + 'px'; - tt2.style.visibility = 'visible'; - } - }, - - moveTest: function(left, top, width, height, paddX, paddY, rightAligned, topAligned) { - var - bakLeft = left, - bakTop = top, - tooltip = Tooltip.tooltip, - tow = Tooltip.tooltipTable.offsetWidth, - toh = Tooltip.tooltipTable.offsetHeight, - tt2 = Tooltip.tooltip2, - tt2w = Tooltip.showSecondary ? Tooltip.tooltipTable2.offsetWidth : 0, - tt2h = Tooltip.showSecondary ? Tooltip.tooltipTable2.offsetHeight : 0, - winSize = $WH.g_getWindowSize(), - scroll = $WH.g_getScroll(), - bcw = winSize.w, - bch = winSize.h, - bsl = scroll.x, - bst = scroll.y, - minX = bsl, - minY = bst, - maxX = bsl + bcw, - maxY = bst + bch; - - if (rightAligned == null) { - rightAligned = (left + width + tow + tt2w <= maxX); - } - - if (topAligned == null) { - topAligned = (top - Math.max(toh, tt2h) >= minY); - } - - if (rightAligned) { - left += width + paddX; - } - else { - left = Math.max(left - (tow + tt2w), minX) - paddX; - } - - if (topAligned) { - top -= Math.max(toh, tt2h) + paddY; - } - else { - top += height + paddY; - } - - if (left < minX) { - left = minX; - } - else if (left + tow + tt2w > maxX) { - left = maxX - (tow + tt2w); - } - - if (top < minY) { - top = minY; - } - else if (top + Math.max(toh, tt2h) > maxY) { - top = Math.max(bst, maxY - Math.max(toh, tt2h)); - } - - if (Tooltip.iconVisible) { - if (bakLeft >= left - 48 && bakLeft <= left && bakTop >= top - 4 && bakTop <= top + 48) { - top -= 48 - (bakTop - top); - } - } - - return $WH.g_createRect(left, top, tow, toh); - }, - - show: function(_this, text, paddX, paddY, spanClass, text2) { - if (Tooltip.disabled) { - return; - } - - if (!paddX || paddX < 1) { - paddX = 1; - } - - if (!paddY || paddY < 1) { - paddY = 1; - } - - if (spanClass) { - text = '' + text + ''; - } - - var coords = $WH.ac(_this); - - Tooltip.prepare(); - Tooltip.set(text, text2); - Tooltip.move(coords.x, coords.y, _this.offsetWidth, _this.offsetHeight, paddX, paddY); - }, - - showAtCursor: function(e, text, paddX, paddY, spanClass, text2) { - if (Tooltip.disabled) { - return; - } - - if (!paddX || paddX < 10) { - paddX = 10; - } - if (!paddY || paddY < 10) { - paddY = 10; - } - - if (spanClass) { - text = '' + text + ''; - if (text2) { - text2 = '' + text2 + ''; - } - } - - e = $WH.$E(e); - var pos = $WH.g_getCursorPos(e); - - Tooltip.prepare(); - Tooltip.set(text, text2); - Tooltip.move(pos.x, pos.y, 0, 0, paddX, paddY); - }, - - showAtXY: function(text, x, y, paddX, paddY, text2) { - if (Tooltip.disabled) { - return; - } - - Tooltip.prepare(); - Tooltip.set(text, text2); - Tooltip.move(x, y, 0, 0, paddX, paddY); - }, - - cursorUpdate: function(e, x, y) { // Used along with showAtCursor - if (Tooltip.disabled || !Tooltip.tooltip) { - return; - } - - e = $WH.$E(e); - - if (!x || x < 10) { - x = 10; - } - if (!y || y < 10) { - y = 10; - } - - var pos = $WH.g_getCursorPos(e); - Tooltip.move(pos.x, pos.y, 0, 0, x, y); - }, - - hide: function() { - if (Tooltip.tooltip) { - Tooltip.tooltip.style.display = 'none'; - Tooltip.tooltip.visibility = 'hidden'; - Tooltip.tooltipTable.className = ''; - - Tooltip.setIcon(null); - } - - if (Tooltip.tooltip2) { - Tooltip.tooltip2.style.display = 'none'; - Tooltip.tooltip2.visibility = 'hidden'; - Tooltip.tooltipTable2.className = ''; - } - }, - - setIcon: function(icon) { - Tooltip.prepare(); - - if (icon) { - Tooltip.icon.style.backgroundImage = 'url(images/icons/medium/' + icon.toLowerCase() + '.jpg)'; - Tooltip.icon.style.visibility = 'visible'; - } - else { - Tooltip.icon.style.backgroundImage = 'none'; - Tooltip.icon.style.visibility = 'hidden'; - } - - Tooltip.iconVisible = icon ? 1 : 0; - } -}; - var LiveSearch = new function() { var currentTextbox, @@ -14948,10 +15246,6 @@ var ScreenshotViewer = new function() { divFrom.style.display = (hasFrom1 || hasFrom2 ? '': 'none'); - if (g_getLocale(true) != 0 && screenshot.caption) { - screenshot.caption = ''; - } - var hasCaption = (screenshot.caption != null && screenshot.caption.length); var hasSubject = (screenshot.subject != null && screenshot.subject.length && screenshot.type && screenshot.typeId); diff --git a/template/js/locale_dede.js b/template/js/locale_dede.js index 5dc036b2..60db0f34 100644 --- a/template/js/locale_dede.js +++ b/template/js/locale_dede.js @@ -837,13 +837,19 @@ var mn_tools = [ ]], [8,"Hilfsmittel",,[ [,"Datenbank"], - [4,"Zufällige Seite","?random"], [0,"Neueste Ergänzungen","?latest-additions"], [1,"Neueste Artikel","?latest-articles"], + [2,"Neueste Kommentare","?latest-comments"], [3,"Neueste Screenshots","?latest-screenshots"], [11,"Neueste Videos","?latest-videos"], - [2,"Neueste Kommentare","?latest-comments"], + [12,"Meiste Kommentare",,[ + [1,"Gestern","?most-comments"], + [7,"Vergangene 7 Tage","?most-comments=7"], + [30,"Vergangene 30 Tage","?most-comments=30"] + ]], [5,"Nicht bewertete Kommentare","?unrated-comments"], + [13,"Fehlende Screenshots","?missing-screenshots"], + [4,"Zufällige Seite","?random"] ]] ]; var mn_community = [ @@ -3718,30 +3724,30 @@ var LANG = { pr_dialog_level: "Stufe: ", - menu_charlookup: "Nach Namen suchen...", - menu_newprofile: "Neues individuelles Profil", - menu_chooseclassspec: "Wählt Eure Klasse/Spezialisierung", + menu_charlookup: "Nach Namen suchen...", + menu_newprofile: "Neues individuelles Profil", + menu_chooseclassspec: "Wählt Eure Klasse/Spezialisierung", pr_selectregion: "Wählt eine Region", - pr_menu_equip: "Anlegen...", - pr_menu_replace: "Ersetzen...", - pr_menu_add: "Hinzufügen...", - pr_menu_unequip: "Ablegen", - pr_menu_remove: "Entfernen", - pr_menu_addgem: "Edelstein hinzufügen...", - pr_menu_repgem: "Edelstein ersetzen...", - pr_menu_addenchant: "Verzauberung hinzufügen...", - pr_menu_repenchant: "Verzauberung ersetzen...", - pr_menu_addsubitem: "Zufällige Eigenschaft hinzufügen", - pr_menu_repsubitem: "Zufällige Eigenschaft ersetzen", - pr_menu_extrasock: "Zusätzlicher Sockel", - pr_menu_display: "Vorschau", - pr_menu_clearenh: "Verbesserungen entfernen", - pr_menu_links: "Links", - pr_menu_compare: "Vergleichen", - pr_menu_upgrades: "Bessere Gegenstände finden", - pr_menu_whowears: "Wer trägt dies?", + pr_menu_equip: "Anlegen...", + pr_menu_replace: "Ersetzen...", + pr_menu_add: "Hinzufügen...", + pr_menu_unequip: "Ablegen", + pr_menu_remove: "Entfernen", + pr_menu_addgem: "Edelstein hinzufügen...", + pr_menu_repgem: "Edelstein ersetzen...", + pr_menu_addenchant: "Verzauberung hinzufügen...", + pr_menu_repenchant: "Verzauberung ersetzen...", + pr_menu_addsubitem: "Zufällige Eigenschaft hinzufügen", + pr_menu_repsubitem: "Zufällige Eigenschaft ersetzen", + pr_menu_extrasock: "Zusätzlicher Sockel", + pr_menu_display: "Vorschau", + pr_menu_clearenh: "Verbesserungen entfernen", + pr_menu_links: "Links", + pr_menu_compare: "Vergleichen", + pr_menu_upgrades: "Bessere Gegenstände finden", + pr_menu_whowears: "Wer trägt dies?", pr_noneitem: "Nichts", pr_nonegem: "Nichts", diff --git a/template/js/locale_enus.js b/template/js/locale_enus.js index cc4be7a7..b83bc828 100644 --- a/template/js/locale_enus.js +++ b/template/js/locale_enus.js @@ -881,15 +881,21 @@ var mn_tools = [ ["pilgrims-bounty","Pilgrim's Bounty","?guide=pilgrims-bounty"], ["winter-veil","Feast of Winter Veil","?guide=winter-veil"] ]], - [8,"Utilities","",[ + [8,"Utilities",,[ [,"Database"], - [4,"Random Page","?random"], [0,"Latest Additions","?latest-additions"], [1,"Latest Articles","?latest-articles"], - [3,"Latest Screenshots","?latest-screenshots"], - [11,"Latest Vídeos","?latest-videos"], [2,"Latest Comments","?latest-comments"], - [5,"Unrated Comments","?unrated-comments"] + [3,"Latest Screenshots","?latest-screenshots"], + [11,"Latest Videos","?latest-videos"], + [12,"Most Comments",,[ + [1,"Yesterday","?most-comments"], + [7,"Past 7 Days","?most-comments=7"], + [30,"Past 30 Days","?most-comments=30"] + ]], + [5,"Unrated Comments","?unrated-comments"], + [13,"Missing Screenshots","?missing-screenshots"], + [4,"Random Page","?random"] ]] ]; var mn_community = [ @@ -3763,30 +3769,30 @@ var LANG = { pr_dialog_level: "Level:", - menu_charlookup: "Lookup by name...", - menu_newprofile: "New Custom Profile", - menu_chooseclassspec: "Choose Your Class/Spec", + menu_charlookup: "Lookup by name...", + menu_newprofile: "New Custom Profile", + menu_chooseclassspec: "Choose Your Class/Spec", pr_selectregion: "Select a region", - pr_menu_equip: "Equip...", - pr_menu_replace: "Replace...", - pr_menu_add: "Add...", - pr_menu_unequip: "Unequip", - pr_menu_remove: "Remove", - pr_menu_addgem: "Add Gem...", - pr_menu_repgem: "Replace Gem...", - pr_menu_addenchant: "Add Enchant...", - pr_menu_repenchant: "Replace Enchant...", - pr_menu_addsubitem: "Add Random Property...", - pr_menu_repsubitem: "Replace Random Property...", - pr_menu_extrasock: "Extra Socket", - pr_menu_display: "Display on Character", - pr_menu_clearenh: "Clear Enhancements", - pr_menu_links: "Links", - pr_menu_compare: "Compare", - pr_menu_upgrades: "Find Upgrades", - pr_menu_whowears: "Who Wears This?", + pr_menu_equip: "Equip...", + pr_menu_replace: "Replace...", + pr_menu_add: "Add...", + pr_menu_unequip: "Unequip", + pr_menu_remove: "Remove", + pr_menu_addgem: "Add Gem...", + pr_menu_repgem: "Replace Gem...", + pr_menu_addenchant: "Add Enchant...", + pr_menu_repenchant: "Replace Enchant...", + pr_menu_addsubitem: "Add Random Property...", + pr_menu_repsubitem: "Replace Random Property...", + pr_menu_extrasock: "Extra Socket", + pr_menu_display: "Display on Character", + pr_menu_clearenh: "Clear Enhancements", + pr_menu_links: "Links", + pr_menu_compare: "Compare", + pr_menu_upgrades: "Find Upgrades", + pr_menu_whowears: "Who Wears This?", pr_noneitem: "None", pr_nonegem: "None", diff --git a/template/js/locale_eses.js b/template/js/locale_eses.js index 059945dc..d97ace9d 100644 --- a/template/js/locale_eses.js +++ b/template/js/locale_eses.js @@ -837,13 +837,19 @@ var mn_tools = [ ]], [8,"Utilidades",,[ [,"Base de datos"], - [4,"Página aleatoria","?random"], [0,"Últimas adiciones","?latest-additions"], [1,"Últimos artículos","?latest-articles"], + [2,"Últimos comentarios","?latest-comments"], [3,"Últimas capturas de pantalla","?latest-screenshots"], [11,"Últimos vídeos","?latest-videos"], - [2,"Últimos comentarios","?latest-comments"], - [5,"Comentarios sin valorar","?unrated-comments"] + [12,"Mayoría de comentarios",,[ + [1,"Ayer","?most-comments"], + [7,"Pasados 7 días","?most-comments=7"], + [30,"Pasados 30 días","?most-comments=30"] + ]], + [5,"Comentarios sin valorar","?unrated-comments"], + [13,"Capturas de pantalla faltantes","?missing-screenshots"], + [4,"Página aleatoria","?random"] ]] ]; var mn_community = [ diff --git a/template/js/locale_frfr.js b/template/js/locale_frfr.js index 6b4c2f82..e58c745b 100644 --- a/template/js/locale_frfr.js +++ b/template/js/locale_frfr.js @@ -837,13 +837,19 @@ var mn_tools = [ ]], [8,"Utilitaires",,[ [,"Base de données"], - [4,"Page au hasard","?random"], [0,"Derniers ajouts","?latest-additions"], [1,"Derniers articles","?latest-articles"], + [2,"Derniers commentaires","?latest-comments"], [3,"Dernières captures d'écran","?latest-screenshots"], [11,"Derniers vidéos","?latest-videos"], - [2,"Derniers commentaires","?latest-comments"], - [5,"Commentaire sans note","?unrated-comments"] + [12,"Le plus de commentaires",,[ + [1,"Hier","?most-comments"], + [7,"Derniers 7 jours","?most-comments=7"], + [30,"Derniers 30 jours","?most-comments=30"] + ]], + [5,"Commentaire sans note","?unrated-comments"], + [13,"Captures d'écrans manquantes","?missing-screenshots"], + [4,"Page au hasard","?random"] ]] ]; var mn_community = [ diff --git a/template/js/locale_ruru.js b/template/js/locale_ruru.js index d553c259..a62c968c 100644 --- a/template/js/locale_ruru.js +++ b/template/js/locale_ruru.js @@ -837,13 +837,19 @@ var mn_tools = [ ]], [8,"Дополнительно",,[ [,"База данных"], - [4,"Случайная страница","?random"], - [0,"Новые добавления","?latest-additions"], + [0,"Последние добавления","?latest-additions"], [1,"Новые статьи","?latest-articles"], - [3,"Новые изображения","?latest-screenshots"], + [2,"Последние комментарии","?latest-comments"], + [3,"Последние изображения","?latest-screenshots"], [11,"Последние видео","?latest-videos"], - [2,"Новые комментарии","?latest-comments"], - [5,"Комментарии без оценки","?unrated-comments"] + [12,"Популярные комментируемые",,[ + [1,"Вчера","?most-comments"], + [7,"Последние 7 дней","?most-comments=7"], + [30,"Последние 30 дней","?most-comments=30"] + ]], + [5,"Комментарии без оценки","?unrated-comments"], + [13,"Без изображений","?missing-screenshots"], + [4,"Случайная страница","?random"] ]] ]; var mn_community = [ diff --git a/template/js/petcalc.js b/template/js/petcalc.js index 35e0975c..6ce32dc4 100644 --- a/template/js/petcalc.js +++ b/template/js/petcalc.js @@ -35,7 +35,7 @@ function pc_init() { link.onclick = pc_classClick.bind(link, classId); link.onmouseover = pc_classOver.bind(link, classId); - link.onmouseout = Tooltip.hide; + link.onmouseout = $WH.Tooltip.hide; $WH.ae(div, icon); } @@ -63,14 +63,14 @@ function pc_init() { function pc_classClick(classId) { if (pc_object.setClass(classId)) { - Tooltip.hide(); + $WH.Tooltip.hide(); } return false; } function pc_classOver(classId) { - Tooltip.show(this, '' + g_pet_families[classId] + ''); + $WH.Tooltip.show(this, '' + g_pet_families[classId] + ''); } function pc_onChange(tc, info, data) { diff --git a/template/js/talent.js b/template/js/talent.js index 9499c380..c1a216ad 100644 --- a/template/js/talent.js +++ b/template/js/talent.js @@ -32,7 +32,7 @@ function tc_init() { link.onclick = tc_classClick.bind(link, classId); link.onmouseover = tc_classOver.bind(link, classId); - link.onmouseout = Tooltip.hide; + link.onmouseout = $WH.Tooltip.hide; $WH.ae(_, icon); } @@ -54,14 +54,14 @@ function tc_init() { function tc_classClick(classId) { if (tc_object.setClass(classId)) { - Tooltip.hide(); + $WH.Tooltip.hide(); } return false; } function tc_classOver(classId) { - Tooltip.show(this, '' + g_chr_classes[classId] + '', 0, 0, 'c' + classId); + $WH.Tooltip.show(this, '' + g_chr_classes[classId] + '', 0, 0, 'c' + classId); } function tc_onChange(tc, info, data) { diff --git a/template/pet.tpl b/template/pet.tpl index 9f25c9ab..3843e84f 100644 --- a/template/pet.tpl +++ b/template/pet.tpl @@ -16,7 +16,7 @@ g_initPath({$page.path}); //]]> -{include file='bricks/infobox.tpl'} +{include file='bricks/infobox.tpl' info=$lvData.infobox}
    {$lang.links}{$lang.links} diff --git a/template/search.tpl b/template/search.tpl index 8c278ccc..1bcb0bd0 100644 --- a/template/search.tpl +++ b/template/search.tpl @@ -14,7 +14,7 @@

    {$lang.foundResult} {$search|escape:"html"}

    -
    +
    -{include file='bricks/infobox.tpl'} +{include file='bricks/infobox.tpl' info=$lvData.infobox} @@ -36,7 +36,7 @@ {if !empty($lvData.page.buff)} @@ -45,7 +45,7 @@
    {$lvData.page.buff}
    {/if} diff --git a/template/spells.tpl b/template/spells.tpl index b0ce506b..7039dd1c 100644 --- a/template/spells.tpl +++ b/template/spells.tpl @@ -60,7 +60,7 @@ - +
       
    @@ -128,7 +128,7 @@ {if isset($filter.setCr)}{$filter.setCr}{/if} //]]> -
    +
    diff --git a/template/title.tpl b/template/title.tpl index 88458ba8..c6a7c669 100644 --- a/template/title.tpl +++ b/template/title.tpl @@ -16,7 +16,7 @@ g_initPath({$page.path}); //]]> -{include file='bricks/infobox.tpl'} +{include file='bricks/infobox.tpl' info=$lvData.infobox}