diff --git a/datasets/weight-presets b/datasets/weight-presets
index 04fa6472..9faeb6d1 100644
--- a/datasets/weight-presets
+++ b/datasets/weight-presets
@@ -1,7 +1,7 @@
var wt_presets = {
1: {
pve: {
- // arms: {__icon:'ability_warrior_savageblow'},
+ arms: {__icon:'ability_rogue_eviscerate'},
fury: {__icon:'ability_warrior_innerrage',exprtng:100,str:82,critstrkrtng:66,agi:53,armorpenrtng:52,hitrtng:48,hastertng:36,atkpwr:31,armor:5},
prot: {__icon:'ability_warrior_defensivestance',sta:100,dodgertng:90,defrtng:86,block:81,agi:67,parryrtng:67,blockrtng:48,str:48,exprtng:19,hitrtng:10,armorpenrtng:10,critstrkrtng:7,armor:6,hastertng:1,atkpwr:1}
}
@@ -16,8 +16,8 @@ var wt_presets = {
3: {
pve: {
beast: {__icon:'ability_hunter_beasttaming',rgddps:213,hitrtng:100,agi:58,critstrkrtng:40,int:37,atkpwr:30,armorpenrtng:28,hastertng:21},
- marks: {__icon:'ability_hunter_focusedaim',rgddps:379,hitrtng:100,agi:74,critstrkrtng:57,armorpenrtng:40,int:39,atkpwr:32,hastertng:24},
- surv: {__icon:'inv_spear_02',rgddps:181,hitrtng:100,agi:76,critstrkrtng:42,int:35,hastertng:31,atkpwr:29,armorpenrtng:26}
+ marks: {__icon:'ability_marksmanship',rgddps:379,hitrtng:100,agi:74,critstrkrtng:57,armorpenrtng:40,int:39,atkpwr:32,hastertng:24},
+ surv: {__icon:'ability_hunter_swiftstrike',rgddps:181,hitrtng:100,agi:76,critstrkrtng:42,int:35,hastertng:31,atkpwr:29,armorpenrtng:26}
}
},
4: {
@@ -29,7 +29,7 @@ var wt_presets = {
},
5: {
pve: {
- disc: {__icon:'spell_holy_powerwordshield',splpwr:100,manargn:67,int:65,hastertng:59,critstrkrtng:48,spi:22},
+ disc: {__icon:'spell_holy_wordfortitude',splpwr:100,manargn:67,int:65,hastertng:59,critstrkrtng:48,spi:22},
holy: {__icon:'spell_holy_guardianspirit',manargn:100,int:69,splpwr:60,spi:52,critstrkrtng:38,hastertng:31},
shadow: {__icon:'spell_shadow_shadowwordpain',hitrtng:100,shasplpwr:76,splpwr:76,critstrkrtng:54,hastertng:50,spi:16,int:16}
}
@@ -45,7 +45,7 @@ var wt_presets = {
7: {
pve: {
elem: {__icon:'spell_nature_lightning',hitrtng:100,splpwr:60,hastertng:56,critstrkrtng:40,int:11},
- enhance: {__icon:'spell_shaman_improvedstormstrike',mledps:135,hitrtng:100,exprtng:84,agi:55,int:55,critstrkrtng:55,hastertng:42,str:35,atkpwr:32,splpwr:29,armorpenrtng:26},
+ enhance: {__icon:'spell_nature_lightningshield',mledps:135,hitrtng:100,exprtng:84,agi:55,int:55,critstrkrtng:55,hastertng:42,str:35,atkpwr:32,splpwr:29,armorpenrtng:26},
resto: {__icon:'spell_nature_magicimmunity',manargn:100,int:85,splpwr:77,critstrkrtng:62,hastertng:35}
}
},
@@ -66,9 +66,9 @@ var wt_presets = {
11: {
pve: {
balance: {__icon:'spell_nature_starfall',hitrtng:100,splpwr:66,hastertng:54,critstrkrtng:43,spi:22,int:22},
- feraldps: {__icon:'ability_druid_catform',agi:100,armorpenrtng:90,str:80,critstrkrtng:55,exprtng:50,hitrtng:50,feratkpwr:40,atkpwr:40,hastertng:35},
feraltank: {__icon:'ability_racial_bearform',agi:100,sta:75,dodgertng:65,defrtng:60,exprtng:16,str:10,armor:10,hitrtng:8,hastertng:5,atkpwr:4,feratkpwr:4,critstrkrtng:3},
- resto: {__icon:'spell_nature_healingtouch',splpwr:100,manargn:73,hastertng:57,int:51,spi:32,critstrkrtng:11}
+ resto: {__icon:'spell_nature_healingtouch',splpwr:100,manargn:73,hastertng:57,int:51,spi:32,critstrkrtng:11},
+ feraldps: {__icon:'ability_druid_catform',agi:100,armorpenrtng:90,str:80,critstrkrtng:55,exprtng:50,hitrtng:50,feratkpwr:40,atkpwr:40,hastertng:35}
}
}
};
diff --git a/includes/user.class.php b/includes/user.class.php
index 99618a1e..1c9122f5 100644
--- a/includes/user.class.php
+++ b/includes/user.class.php
@@ -262,6 +262,7 @@ class User
'name' => self::$displayName ? self::$displayName : '',
'perms' => self::$perms ? self::$perms : 0,
'roles' => self::$groups ? self::$groups : 0,
+ 'cookies' => []
);
if (self::$id > 0)
@@ -280,7 +281,8 @@ class User
'avatar' => self::$avatar,
'community' => self::$description,
'chars' => self::getCharacters(),
- 'profiles' => self::getProfiles()
+ 'profiles' => self::getProfiles(),
+ 'cookies' => self::getCookies(),
);
if ($_ = self::getWeightScales())
@@ -328,10 +330,10 @@ class User
// todo: do after profiler
// existing chars on realm(s)
if ($asJSON)
- $chars = '[{"name":"ExampleChar", "realmname":"Example Realm", "region":"eu", "realm":"exrealm", icon:"inv_axe_04", "race":4, "gender":0, "classs":11, "level":80}]';
+ $chars = '[{"name":"ExampleChar", "realmname":"Example Realm", "region":"eu", "realm":"exrealm", icon:"inv_axe_04", "race":4, "gender":0, "classs":11, "level":80, "pinned":1}]';
else
$chars = array(
- array("name" => "ExampleChar", "realmname" => "Example Realm", "region" => "eu", "realm" => "exrealm", "icon" => "inv_axe_04", "race" => 4, "gender" => 0, "classs" => 11, "level" => 80)
+ array("name" => "ExampleChar", "realmname" => "Example Realm", "region" => "eu", "realm" => "exrealm", "icon" => "inv_axe_04", "race" => 4, "gender" => 0, "classs" => 11, "level" => 80, "pinned" => 1)
);
self::$characters = $chars;
@@ -358,6 +360,16 @@ class User
return self::$profiles;
}
+ public static function getCookies()
+ {
+ $data = [];
+
+ if (self::$id)
+ $data = DB::Aowow()->selectCol('SELECT name AS ARRAY_KEY, data FROM ?_account_cookies WHERE userId = ?d', self::$id);
+
+ return json_encode($data);
+ }
+
public static function writeCookie()
{
$cookie = self::$localeId.count(dechex(self::$id)).dechex(self::$id).base64_encode(self::$passHash);
diff --git a/index.php b/index.php
index fe82933f..0800a135 100644
--- a/index.php
+++ b/index.php
@@ -55,6 +55,8 @@ switch ($pageCall)
case 'races':
case 'skill':
case 'skills':
+ // case 'sound': // db: sounds for zone, creature, spell, ...
+ // case 'sounds':
case 'spell':
case 'spells':
case 'title':
@@ -73,23 +75,26 @@ switch ($pageCall)
require 'pages/talent.php';
break;
/* called by script */
- case 'contactus':
- if ($pageCall == 'contactus')
+ case 'cookie': // lossless cookies and user settings
+ if (User::$id && $pageParam && !empty($_GET[$pageParam]))
{
- // 0:ok; 1:captchaInvalid; 2:tooLong; 3:noReasonGiven; 7:alreadyReported; other:prints String
- die("not yet implemented:\n".print_r($_POST));
+ // don't panic .. again .... it get's escaped
+ if (DB::Aowow()->query('REPLACE INTO ?_account_cookies VALUES (?d, ?, ?)', User::$id, $pageParam, urldecode($_GET[$pageParam])))
+ die('0'); // 0: success
+ else
+ die();
}
+
+ break;
+ case 'contactus':
+ die("not yet implemented:\n".print_r($_POST)); // 0:ok; 1:captchaInvalid; 2:tooLong; 3:noReasonGiven; 7:alreadyReported; other:prints String
case 'comment':
if ($pageParam == 'rating')
- {
- // why is this called via index...?
die('{"success":true,"error":"","up":7,"down":9}');
- }
else if ($pageParam == 'rate')
- {
- // 0:success, 1:ratingban, 3:rated too often
- die('3');
- }
+ die('3'); // 0:success, 1:ratingban, 3:rated too often
+
+ break;
case 'locale': // subdomain-workaround, change the language
User::setLocale($pageParam);
User::writeCookie();
@@ -117,13 +122,13 @@ switch ($pageCall)
case 'build':
if (User::isInGroup(U_GROUP_EMPLOYEE))
{
- require 'setup/tools/dataset-assembler/'.$pageParam.'.php';
+ require 'setup/tools/dataset/'.$pageParam.'.php';
break;
}
case 'sql':
if (User::isInGroup(U_GROUP_EMPLOYEE))
{
- require 'setup/tools/sql/_'.$pageParam.'.php';
+ require 'setup/tools/database/_'.$pageParam.'.php';
break;
}
case 'setup':
diff --git a/pages/compare.php b/pages/compare.php
index 06b31bec..ec4a728b 100644
--- a/pages/compare.php
+++ b/pages/compare.php
@@ -16,6 +16,7 @@ $pageData = array(
['path' => 'template/css/Summary_ie6.css', 'ieCond' => 'lte IE 6'],
),
'reqJS' => array(
+ 'template/js/profile.js',
'template/js/Draggable.js',
'template/js/filters.js',
'template/js/Summary.js',
diff --git a/template/head.tpl b/template/head.tpl
index 3cfa2bf9..52679dd5 100644
--- a/template/head.tpl
+++ b/template/head.tpl
@@ -36,7 +36,8 @@
id:{$user.id},
name:'{$user.name|escape:"quotes"}',
roles:{$user.roles},
- permissions:{$user.perms}
+ permissions:{$user.perms},
+ cookies: {$user.cookies}
{if isset($user.chars)}, characters: {$user.chars} {/if}
{if isset($user.profiles)}, profiles: {$user.profiles}{/if}
{if isset($user.weights)}, weightscales: {$user.weights}{/if}
diff --git a/template/js/Mapper.js b/template/js/Mapper.js
index 7090d103..9f906743 100644
--- a/template/js/Mapper.js
+++ b/template/js/Mapper.js
@@ -713,8 +713,10 @@ Mapper.prototype = {
this.sZoom.style.display = 'none';
}
+/* sarjuuk: thats one feature i never understood. the inflatable map is superior to the popup in every way possible
if(this.zoom)
MapViewer.show({ mapper: this });
+*/
},
getShow: function() { return this.show; },
diff --git a/template/js/Summary.js b/template/js/Summary.js
index 66f5ca03..698108bd 100644
--- a/template/js/Summary.js
+++ b/template/js/Summary.js
@@ -105,7 +105,7 @@ function Summary(opt) {
this.level = parseInt(GET.l);
}
else {
- var l = $WH.gc('compare_level');
+ var l = g_getWowheadCookie('compare_level');
if (l) {
this.level = l;
}
@@ -118,7 +118,7 @@ function Summary(opt) {
this.readGroups(GET.compare);
}
else {
- this.readGroups($WH.gc('compare_groups'));
+ this.readGroups(g_getWowheadCookie('compare_groups'));
}
}
@@ -130,7 +130,7 @@ function Summary(opt) {
this.readWeights(GET.weights);
}
else {
- this.readWeights($WH.gc('compare_weights'));
+ this.readWeights(g_getWowheadCookie('compare_weights'));
}
}
}
@@ -1298,10 +1298,10 @@ Summary.prototype = {
// Enchant
if (this.canBeEnchanted(g_items[itemId].jsonequip.slotbak, g_items[itemId].jsonequip.subclass)) {
- var _ = [0, (item[2] ? LANG.pr_menu_repenchant : LANG.pr_menu_addenchant), this.openEnchantPicker.bind(this, col, i)];
+ var _ = [0, (item[2] ? LANG.pr_menu_repenchant : LANG.pr_menu_addenchant), this.openEnchantPicker.bind(this, col, i), null, {}];
if (item[2] && g_enchants[item[2]]) {
- _.tinyIcon = g_enchants[item[2]].icon;
+ _[4].tinyIcon = g_enchants[item[2]].icon;
}
menu.push(_);
@@ -1313,13 +1313,13 @@ Summary.prototype = {
var
gemId = (item[k + 4] > 0 ? item[k + 4] : 0),
c = (extraSocket && k == len3 - 1 ? 14 : g_items[itemId].jsonequip['socket' + (k + 1)]),
- _ = [0, (gemId ? LANG.pr_menu_repgem : LANG.pr_menu_addgem), this.openGemPicker.bind(this, col, i, 4 + k, c)];
+ _ = [0, (gemId ? LANG.pr_menu_repgem : LANG.pr_menu_addgem), this.openGemPicker.bind(this, col, i, 4 + k, c), null, {}];
if (gemId) {
- _.tinyIcon = g_gems[gemId].icon;
+ _[4].tinyIcon = g_gems[gemId].icon;
}
else {
- _.socketColor = c;
+ _[4].socketColor = c;
}
menu.push(_);
@@ -1648,12 +1648,9 @@ Summary.prototype = {
saveComparison: function(refresh) {
window.onbeforeunload = null;
- // g_setWowheadCookie('compare_groups', this.getGroupData(), true);
- $WH.sc('compare_groups', 20, this.getGroupData(), '/', location.hostname);
- // g_setWowheadCookie('compare_weights', $WH.rtrim(this.getWeightData(1).join(';'), ';'), true);
- $WH.sc('compare_weights', 20, $WH.rtrim(this.getWeightData(1).join(';'), ';'), '/', location.hostname);
- // g_setWowheadCookie('compare_level', this.level, true);
- $WH.sc('compare_level', 20, this.level, '/', location.hostname);
+ g_setWowheadCookie('compare_groups', this.getGroupData(), true);
+ g_setWowheadCookie('compare_weights', $WH.rtrim(this.getWeightData(1).join(';'), ';'), true);
+ g_setWowheadCookie('compare_level', this.level, true);
if (refresh) {
document.location.href = '?compare'
@@ -2046,7 +2043,7 @@ Summary.prototype = {
a = this.createControl(LANG.su_autosaving, null, 'autosave-icon selected');
}
else {
- if ($WH.gc('compare_groups')) {
+ if (g_getWowheadCookie('compare_groups')) {
a = this.createControl(LANG.su_viewsaved, 'su_viewsaved', 'save-icon', this.viewSavedComparison.bind(this, 1));
$WH.ae(div, a);
}
@@ -2464,11 +2461,12 @@ Summary.prototype = {
$WH.aE(this.searchName, 'keyup', this.onSearchKeyUp.bind(this, 333));
$WH.aE(this.searchName, 'keydown', this.onSearchKeyDown.bind(this));
-
$WH.ae(sm, this.searchName);
+
this.searchMsg = sp;
this.searchMsg.style.fontWeight = 'bold';
$WH.ae(sm, this.searchMsg);
+
$WH.ae(div, sm);
},
@@ -3217,7 +3215,7 @@ Summary.prototype = {
searchItems: function(search, type) {
var
- lv = g_listviews.items,
+ lv = g_listviews.items,
_this = this,
searchResults = [{ none: 1 }];
@@ -3236,7 +3234,7 @@ Summary.prototype = {
new Ajax('?search=' + $WH.urlencode(search) + '&json&type=' + type + pr_getScaleFilter(this.currentScale, 1), {
method: 'POST',
search: search,
- onSuccess: function(xhr, opt) {
+ onSuccess: function (xhr, opt) {
var text = xhr.responseText;
if (text.charAt(0) != '[' || text.charAt(text.length - 1) != ']') {
return;
@@ -3245,7 +3243,7 @@ Summary.prototype = {
var a = eval(text);
if (search == opt.search && a.length == 3 && a[1].length) {
for (var i = 0, len = a[1].length; i < len; ++i) {
- var row = {};
+ var row = {};
row.id = a[1][i].id;
row.name = row['name_' + g_locale.name] = a[1][i].name.substring(1);
row.quality = 7 - a[1][i].name.charAt(0);
@@ -5076,35 +5074,3 @@ Listview.templates.gempicker = {
}
]
};
-
-/* sarjuuk: bandaid .. belongs to profile.js */
-function pr_getScaleFilter(scale, noFilter) {
- var temp = [];
-
- if (scale) {
- for (var i = 0, len = fi_filters.items.length; i < len; ++i) {
- var f = fi_filters.items[i];
-
- if (LANG.traits[f.name] && scale[f.name]) {
- temp.push([f.id, scale[f.name]]);
- }
- }
- }
-
- temp.sort(function(a, b) {
- return -$WH.strcmp(a[1], b[1]);
- });
-
- var wt = [], wtv = [];
- for (var i = 0, len = temp.length; i < len; ++i) {
- wt.push(temp[i][0]);
- wtv.push(temp[i][1]);
- }
-
- if (wt.length && wtv.length) {
- return (noFilter ? '&' : ';gm=3;rf=1;') + 'wt=' + wt.join(':') + (noFilter ? '&' : ';') + 'wtv=' + wtv.join(':');
- }
-
- return '';
-}
-
diff --git a/template/js/basic.js b/template/js/basic.js
index b72bf1a2..df7f4884 100644
--- a/template/js/basic.js
+++ b/template/js/basic.js
@@ -342,7 +342,7 @@ $WH.array_unique = function(a) {
// Get element
$WH.ge = function(z) {
- if(typeof z != 'string') {
+ if (typeof z != 'string') {
return z;
}
@@ -545,7 +545,7 @@ $WH.gc = function(z) {
// Prevent element from being selected/dragged (IE only)
$WH.ns = function(a) {
if ($WH.Browser.ie6789) {
- a.onfocus = tb;
+ a.onfocus = $WH.tb;
a.onmousedown = a.onselectstart = a.ondragstart = $WH.rf;
}
}
@@ -1206,7 +1206,7 @@ $WH.g_convertScalingFactor = function(level, factor, dist, stat, json) {
var scalingValues = $WH.g_convertScalingFactor.SV;
var scalingDistributions = $WH.g_convertScalingFactor.SD;
- if(!scalingValues[level]) {
+ if (!scalingValues[level]) {
if (g_user.roles & U_GROUP_ADMIN) {
alert('There are no item scaling values for level ' + level);
}
@@ -1765,7 +1765,7 @@ $WH.Tooltip = {
c[0].style.whiteSpace = 'nowrap';
var m = parseInt(tooltip.style.width);
- if(!tooltip.slider || !m) {
+ if (!tooltip.slider || !m) {
if (c[1].offsetWidth > 300) {
m = Math.max(300, c[0].offsetWidth) + 20;
}
@@ -1780,7 +1780,7 @@ $WH.Tooltip = {
tooltip.style.width = m + 'px';
c[0].style.width = c[1].style.width = '100%';
- if(tooltip.slider) {
+ if (tooltip.slider) {
Slider.setSize(tooltip.slider, m - 6);
tooltip.className += ' tooltip-slider';
}
diff --git a/template/js/filters.js b/template/js/filters.js
index a165e4b1..a59abe41 100644
--- a/template/js/filters.js
+++ b/template/js/filters.js
@@ -1190,6 +1190,10 @@ function fi_presetMatch(weights, stealth) {
for (var l in wt_presets) {
for (var k in wt_presets[l]) {
for (var v in wt_presets[l][k]) {
+ if (Object.keys(wt_presets[l][k][v]).length == 1) {
+ continue;
+ }
+
p = fi_convertWeights(wt_presets[l][k][v]);
var match = true;
diff --git a/template/js/global.js b/template/js/global.js
index 5bd741c8..74c7dc81 100644
--- a/template/js/global.js
+++ b/template/js/global.js
@@ -1692,6 +1692,7 @@ function vi_appendSticky() {
_.innerHTML = $WH.sprintf(LANG.infobox_noneyet, a + LANG.infobox_suggestone + "")
}
}
+
var g_videos = [];
var VideoViewer = new function() {
var
@@ -2087,6 +2088,553 @@ var VideoViewer = new function() {
DomContentLoaded.addEvent(this.checkPound)
};
+var Dialog = function() {
+var
+ _self = this,
+ _template,
+ _onSubmit = null,
+ _templateName,
+
+ _funcs = {},
+ _data,
+
+ _inited = false,
+ _form = $WH.ce('form'),
+ _elements = {};
+
+ _form.onsubmit = function() {
+ _processForm();
+ return false
+ };
+
+ this.show = function(template, opt) {
+ if (template) {
+ _templateName = template;
+ _template = Dialog.templates[_templateName];
+ _self.template = _template;
+ }
+ else {
+ return;
+ }
+
+ if (_template.onInit && !_inited) {
+ (_template.onInit.bind(_self, _form, opt))();
+ }
+
+ if (opt.onBeforeShow) {
+ _funcs.onBeforeShow = opt.onBeforeShow.bind(_self, _form);
+ }
+
+ if (_template.onBeforeShow) {
+ _template.onBeforeShow = _template.onBeforeShow.bind(_self, _form);
+ }
+
+ if (opt.onShow) {
+ _funcs.onShow = opt.onShow.bind(_self, _form);
+ }
+
+ if (_template.onShow) {
+ _template.onShow = _template.onShow.bind(_self, _form);
+ }
+
+ if (opt.onHide) {
+ _funcs.onHide = opt.onHide.bind(_self, _form);
+ }
+
+ if (_template.onHide) {
+ _template.onHide = _template.onHide.bind(_self, _form);
+ }
+
+ if (opt.onSubmit) {
+ _funcs.onSubmit = opt.onSubmit;
+ }
+
+ if (_template.onSubmit)
+ _onSubmit = _template.onSubmit.bind(_self, _form);
+
+ if (opt.data) {
+ _inited = false;
+ _data = {};
+ $WH.cO(_data, opt.data);
+ }
+ _self.data = _data;
+
+ Lightbox.show('dialog-' + _templateName, {
+ onShow: _onShow,
+ onHide: _onHide
+ });
+ };
+
+ this.getValue = function(id) {
+ return _getValue(id);
+ };
+
+ this.setValue = function(id, value) {
+ _setValue(id, value);
+ };
+
+ this.getSelectedValue = function(id) {
+ return _getSelectedValue(id);
+ };
+
+ this.getCheckedValue = function(id) {
+ return _getCheckedValue(id);
+ };
+
+ function _onShow(dest, first) {
+ if (first || !_inited) {
+ _initForm(dest);
+ }
+
+ if (_template.onBeforeShow) {
+ _template.onBeforeShow();
+ }
+
+ if (_funcs.onBeforeShow) {
+ _funcs.onBeforeShow();
+ }
+
+ Lightbox.setSize(_template.width, _template.height);
+ dest.className = 'dialog';
+
+ _updateForm();
+
+ if (_template.onShow) {
+ _template.onShow();
+ }
+
+ if (_funcs.onShow) {
+ _funcs.onShow();
+ }
+ }
+
+ function _initForm(dest) {
+ $WH.ee(dest);
+ $WH.ee(_form);
+
+ var container = $WH.ce('div');
+ container.className = 'text';
+ $WH.ae(dest, container);
+ $WH.ae(container, _form);
+ if (_template.title) {
+ var h = $WH.ce('h1');
+ $WH.ae(h, $WH.ct(_template.title));
+ $WH.ae(_form, h);
+ }
+
+ var
+ t = $WH.ce('table'),
+ tb = $WH.ce('tbody'),
+ mergeCell = false;
+
+ $WH.ae(t, tb);
+ $WH.ae(_form, t);
+
+ for (var i = 0, len = _template.fields.length; i < len; ++i) {
+ var
+ field = _template.fields[i],
+ element;
+
+ if (!mergeCell) {
+ tr = $WH.ce('tr');
+ th = $WH.ce('th');
+ td = $WH.ce('td');
+ }
+
+ field.__tr = tr;
+
+ if (_data[field.id] == null) {
+ _data[field.id] = (field.value ? field.value: '');
+ }
+
+ var options;
+ if (field.options) {
+ options = [];
+
+ if (field.optorder) {
+ $WH.cO(options, field.optorder);
+ }
+ else {
+ for (var j in field.options) {
+ options.push(j);
+ }
+ }
+
+ if (field.sort) {
+ options.sort(function(a, b) {
+ return field.sort * $WH.strcmp(field.options[a], field.options[b]);
+ });
+ }
+ }
+
+ switch (field.type) {
+ case 'caption':
+ th.colSpan = 2;
+ th.style.textAlign = 'left';
+ th.style.padding = 0;
+
+ if (field.compute) {
+ (field.compute.bind(_self, null, _data[field.id], _form, th, tr))();
+ }
+ else if (field.label) {
+ $WH.ae(th, $WH.ct(field.label));
+ }
+
+ $WH.ae(tr, th);
+ $WH.ae(tb, tr);
+
+ continue;
+ break;
+ case 'textarea':
+ var f = element = $WH.ce('textarea');
+
+ f.name = field.id;
+
+ if (field.disabled) {
+ f.disabled = true;
+ }
+
+ f.rows = field.size[0];
+ f.cols = field.size[1];
+ td.colSpan = 2;
+
+ if (field.label) {
+ th.colSpan = 2;
+ th.style.textAlign = 'left';
+ th.style.padding = 0;
+ td.style.padding = 0;
+
+ $WH.ae(th, $WH.ct(field.label));
+ $WH.ae(tr, th);
+ $WH.ae(tb, tr);
+
+ tr = $WH.ce('tr');
+ }
+ $WH.ae(td, f);
+
+ break;
+ case 'select':
+
+ var f = element = $WH.ce('select');
+
+ f.name = field.id;
+
+ if (field.size) {
+ f.size = field.size;
+ }
+
+ if (field.disabled) {
+ f.disabled = true;
+ }
+
+ if (field.multiple) {
+ f.multiple = true;
+ }
+
+ for (var j = 0, len2 = options.length; j < len2; ++j) {
+ var o = $WH.ce('option');
+
+ o.value = options[j];
+
+ $WH.ae(o, $WH.ct(field.options[options[j]]));
+ $WH.ae(f, o)
+ }
+
+ $WH.ae(td, f);
+
+ break;
+ case 'dynamic':
+ td.colSpan = 2;
+ td.style.textAlign = 'left';
+ td.style.padding = 0;
+
+ if (field.compute)
+ (field.compute.bind(_self, null, _data[field.id], _form, td, tr))();
+
+ $WH.ae(tr, td);
+ $WH.ae(tb, tr);
+
+ element = td;
+
+ break;
+ case 'checkbox':
+ case 'radio':
+ var k = 0;
+ element = [];
+ for (var j = 0, len2 = options.length; j < len2; ++j) {
+ var
+ s = $WH.ce('span'),
+ f,
+ l,
+ uniqueId = 'sdfler46' + field.id + '-' + options[j];
+
+ if (j > 0 && !field.noInputBr) {
+ $WH.ae(td, $WH.ce('br'));
+ }
+ if ($WH.Browser.ie6 && field.type == 'radio') {
+ l = $WH.ce("");
+ f = $WH.ce("");
+ }
+ else {
+ l = $WH.ce('label');
+ l.setAttribute('for', uniqueId);
+ l.onmousedown = $WH.rf;
+
+ f = $WH.ce('input');
+ f.setAttribute('type', field.type);
+ f.name = field.id;
+ }
+ f.value = options[j];
+ f.id = uniqueId;
+
+ if (field.disabled) {
+ f.disabled = true;
+ }
+ if (field.submitOnDblClick) {
+ l.ondblclick = f.ondblclick = function(e) {
+ _processForm();
+ };
+ }
+
+ if (field.compute) {
+ (field.compute.bind(_self, f, _data[field.id], _form, td, tr))();
+ }
+
+ $WH.ae(l, f);
+ $WH.ae(l, $WH.ct(field.options[options[j]]));
+ $WH.ae(td, l);
+ element.push(f);
+ }
+ break;
+ default: // Textbox
+ var f = element = $WH.ce('input');
+ f.name = field.id;
+
+ if (field.size) {
+ f.size = field.size;
+ }
+
+ if (field.disabled) {
+ f.disabled = true ;
+ }
+
+ if (field.submitOnEnter) {
+ f.onkeypress = function(e) {
+ e = $WH.$E(e);
+ if (e.keyCode == 13) {
+ _processForm();
+ }
+ }
+ }
+ f.setAttribute('type', field.type);
+ $WH.ae(td, f);
+ break;
+ }
+
+ if (field.label) {
+ if (field.type == 'textarea') {
+ if (field.labelAlign) {
+ td.style.textAlign = field.labelAlign;
+ }
+ td.colSpan = 2;
+ }
+ else {
+ if (field.labelAlign) {
+ th.style.textAlign = field.labelAlign;
+ }
+ $WH.ae(th, $WH.ct(field.label));
+ $WH.ae(tr, th);
+ }
+ }
+
+ if (field.type != 'checkbox' && field.type != 'radio') {
+ if (field.width) {
+ f.style.width = field.width;
+ }
+
+ if (field.compute && field.type != 'caption' && field.type != 'dynamic') {
+ (field.compute.bind(_self, f, _data[field.id], _form, td, tr))();
+ }
+ }
+
+ if (field.caption) {
+ var s = $WH.ce('small');
+ if (field.type != 'textarea')
+ s.style.paddingLeft = '2px';
+ s.className = 'q0'; // commented in 5.0?
+ $WH.ae(s, $WH.ct(field.caption));
+ $WH.ae(td, s);
+ }
+
+ $WH.ae(tr, td);
+ $WH.ae(tb, tr);
+
+ mergeCell = field.mergeCell;
+ _elements[field.id] = element;
+ }
+
+ for (var i = _template.buttons.length; i > 0; --i) {
+ var
+ button = _template.buttons[i - 1],
+ a = $WH.ce('a');
+
+ a.href = 'javascript:;';
+ a.onclick = _processForm.bind(a, button[0]);
+ a.className = 'dialog-' + button[0];
+ $WH.ae(a, $WH.ct(button[1]));
+ $WH.ae(dest, a);
+ }
+
+ var _ = $WH.ce('div');
+ _.className = 'clear';
+ $WH.ae(dest, _);
+
+ _inited = true;
+ }
+
+ function _updateForm() {
+ for (var i = 0, len = _template.fields.length; i < len; ++i) {
+ var
+ field = _template.fields[i],
+ f = _elements[field.id];
+
+ switch (field.type) {
+ case 'caption': // Do nothing
+ break;
+ case 'select':
+ for (var j = 0, len2 = f.options.length; j < len2; j++) {
+ f.options[j].selected = (f.options[j].value == _data[field.id] || $WH.in_array(_data[field.id], f.options[j].value) != -1);
+ }
+ break;
+ case 'checkbox':
+ case 'radio':
+ for (var j = 0, len2 = f.length; j < len2; j++) {
+ f[j].checked = (f[j].value == _data[field.id] || $WH.in_array(_data[field.id], f[j].value) != -1);
+ }
+ break;
+
+ default:
+ f.value = _data[field.id];
+ break;
+ }
+
+ if (field.update) {
+ (field.update.bind(_self, null, _data[field.id], _form, f))();
+ }
+ }
+ }
+
+ function _onHide() {
+ if (_template.onHide) {
+ _template.onHide();
+ }
+ if (_funcs.onHide) {
+ _funcs.onHide();
+ }
+ }
+
+ function _processForm(button) {
+ // if (button == 'x') { // Special case
+ if (button == 'cancel') { // Special case
+ return Lightbox.hide();
+ }
+
+ for (var i = 0, len = _template.fields.length; i < len; ++i) {
+ var
+ field = _template.fields[i],
+ newValue;
+
+ switch (field.type) {
+ case 'caption': // Do nothing
+ continue;
+ case 'select':
+ newValue = _getSelectedValue(field.id);
+ break;
+ case 'checkbox':
+ case 'radio':
+ newValue = _getCheckedValue(field.id);
+ break;
+ case 'dynamic':
+ if (field.getValue) {
+ newValue = field.getValue(field, _data, _form);
+ break;
+ }
+ default:
+ newValue = _getValue(field.id);
+ break;
+ }
+ if (field.validate) {
+ if (!field.validate(newValue, _data, _form)) {
+ return;
+ }
+ }
+
+ if (newValue && typeof newValue == 'string') {
+ newValue = $WH.trim(newValue);
+ }
+ _data[field.id] = newValue;
+ }
+
+ _submitData(button);
+ }
+
+ function _submitData(button) {
+ var ret;
+
+ if (_onSubmit) {
+ ret = _onSubmit(_data, button, _form);
+ }
+
+ if (_funcs.onSubmit) {
+ ret = _funcs.onSubmit(_data, button, _form);
+ }
+
+ if (ret === undefined || ret)
+ Lightbox.hide();
+
+ return false;
+ }
+
+ function _getValue(id) {
+ return _elements[id].value;
+ }
+
+ function _setValue(id, value) {
+ _elements[id].value = value;
+ }
+
+ function _getSelectedValue(id) {
+ var
+ result = [],
+ f = _elements[id];
+
+ for (var i = 0, len = f.options.length; i < len; i++) {
+ if (f.options[i].selected) {
+ result.push(parseInt(f.options[i].value) == f.options[i].value ? parseInt(f.options[i].value) : f.options[i].value);
+ }
+ }
+ if (result.length == 1) {
+ result = result[0];
+ }
+ return result;
+ }
+
+ function _getCheckedValue(id) {
+ var
+ result = [],
+ f = _elements[id];
+
+ for (var i = 0, len = f.length; i < len; i++) {
+ if (f[i].checked) {
+ result.push(parseInt(f[i].value) == f[i].value ? parseInt(f[i].value) : f[i].value);
+ }
+ }
+
+ return result;
+ }
+};
+Dialog.templates = {};
+
var Slider = new function() {
var
start,
@@ -2385,74 +2933,85 @@ var Slider = new function() {
}
};
+/*
+Global functions related to the Summary class (item comparison, item set summary)
+*/
+
var suDialog;
-function su_addToSaved(c, d, a, e) {
- if (!c) {
- return
- }
- if (!Dialog.templates.docompare) {
- Dialog.templates.docompare = {
- title: LANG.dialog_compare,
- width: 400,
- height: 138,
- buttons: [['okay', LANG.ok], ['cancel', LANG.cancel]],
- fields: [{
- id: "selecteditems",
- type: "caption",
- compute: function(h, g, f, i) {
- i.innerHTML = $WH.sprintf((g == 1 ? LANG.dialog_selecteditem: LANG.dialog_selecteditems), g)
- }
- },
- {
- id: "action",
- type: "radio",
- label: "",
- value: 3,
- submitOnDblClick: 1,
- options: {
- 1 : LANG.dialog_nosaveandview,
- 2 : LANG.dialog_saveandview,
- 3 : LANG.dialog_saveforlater
- }
- }]
- }
+
+function su_addToSaved(items, nItems, newWindow, level) {
+ if (!items) {
+ return;
}
+
if (!suDialog) {
- suDialog = new Dialog()
+ suDialog = new Dialog();
}
- var b = function(h) {
- var g = $WH.gc("compare_groups"),
- f = "?compare";
- if (h.action > 1) {
- if (g) {
- c = g + ";" + c
+
+ var doCompare = function(data) {
+ var saved = g_getWowheadCookie('compare_groups'),
+ url = '?compare';
+
+ if (data.action > 1) { // Save
+ if (saved) {
+ items = saved + ';' + items;
}
- $WH.sc("compare_groups", 20, c, "/", location.hostname);
- // $WH.sc("compare_groups", 20, c, "/", ".wowhead.com");
- if (e) {
- $WH.sc("compare_level", 20, e, "/", location.hostname)
- // $WH.sc("compare_level", 20, e, "/", ".wowhead.com")
+
+ g_setWowheadCookie('compare_groups', items, true);
+
+ if (level) {
+ g_setWowheadCookie('compare_level', level, true);
}
- } else {
- f += "=" + c + (e ? "&l=" + e: "")
}
- if (h.action < 3) {
- if (a) {
- window.open(f)
- } else {
- location.href = f
+ else { // Don't save
+ url += '=' + items + (level ? '&l=' + level : '');
+ }
+
+ if (data.action < 3) { // View now
+ if (newWindow) {
+ window.open(url);
+ }
+ else {
+ location.href = url;
}
}
};
- suDialog.show("docompare", {
- data: {
- selecteditems: d,
- action: 1
- },
- onSubmit: b
- })
+
+ suDialog.show('docompare', {
+ data: { selecteditems: nItems, action: 1 },
+ onSubmit: doCompare
+ });
}
+Dialog.templates.docompare = {
+
+ title: LANG.dialog_compare,
+ width: 400,
+ buttons: [['okay', LANG.ok], ['cancel', LANG.cancel]],
+
+ fields: [
+ {
+ id: 'selecteditems',
+ type: 'caption',
+ compute: function(field, value, form, td) {
+ td.innerHTML = $WH.sprintf((value == 1 ? LANG.dialog_selecteditem: LANG.dialog_selecteditems), value);
+ }
+ },
+ {
+ id: 'action',
+ type: 'radio',
+ label: '',
+ value: 3,
+ submitOnDblClick: 1,
+ options: {
+ 1 : LANG.dialog_nosaveandview,
+ 2 : LANG.dialog_saveandview,
+ 3 : LANG.dialog_saveforlater
+ }
+ }
+ ]
+};
+
function Tabs(opt) {
$WH.cO(this, opt);
@@ -9101,8 +9660,10 @@ Listview.templates = {
align: 'left',
value: 'name',
compute: function(npc, td) {
+ var wrapper = $WH.ce('div');
+
if (npc.boss) {
- td.className = 'boss-icon-padded';
+ wrapper.className = 'boss-icon-padded';
}
var a = $WH.ce('a');
@@ -9115,14 +9676,31 @@ Listview.templates = {
a.style.backgroundImage = "url(" + g_staticUrl + "/images/icons/quest_start.gif)";
}
- $WH.ae(td, a);
+ $WH.ae(wrapper, a);
if (npc.tag != null) {
var d = $WH.ce('div');
d.className = 'small';
$WH.ae(d, $WH.ct('<' + npc.tag + '>'));
- $WH.ae(td, d);
+ $WH.ae(wrapper, d);
}
+
+ if (npc.method != null) {
+ td.style.position = 'relative';
+
+ var d = $WH.ce('div');
+ d.className = 'small';
+ d.style.fontStyle = 'italic';
+ d.style.position = 'absolute';
+ d.style.right = '3px';
+ d.style.bottom = '3px';
+ d.style.textAlign = 'right';
+
+ $WH.ae(d, $WH.ct(npc.method ? LANG.added : LANG.lvquest_removed));
+ $WH.ae(wrapper, d);
+ }
+
+ $WH.ae(td, wrapper);
},
getVisibleText: function(npc) {
var buff = npc.name;
@@ -9324,11 +9902,36 @@ Listview.templates = {
align: 'left',
value: 'name',
compute: function(object, td) {
+ var wrapper = $WH.ce('div');
var a = $WH.ce('a');
+
a.style.fontFamily = 'Verdana, sans-serif';
a.href = this.getItemLink(object);
$WH.ae(a, $WH.ct(object.name));
- $WH.ae(td, a);
+
+ if (object.hasQuests != null) {
+ a.className += " icontiny tinyspecial";
+ a.style.backgroundImage = "url(" + g_staticUrl + "/images/icons/quest_start.gif)";
+ }
+
+ $WH.ae(wrapper, a);
+
+ if (object.method != null) {
+ td.style.position = 'relative';
+
+ var d = $WH.ce('div');
+ d.className = 'small';
+ d.style.fontStyle = 'italic';
+ d.style.position = 'absolute';
+ d.style.right = '3px';
+ d.style.bottom = '3px';
+ d.style.textAlign = 'right';
+
+ $WH.ae(d, $WH.ct(object.method ? LANG.added : LANG.lvquest_removed));
+ $WH.ae(wrapper, d);
+ }
+
+ $WH.ae(td, wrapper);
}
},
{
@@ -15679,6 +16282,100 @@ var Lightbox = new function() {
}
};
+/*
+Locale class
+*/
+
+var LOCALE_ENUS = 0;
+var LOCALE_FRFR = 2;
+var LOCALE_DEDE = 3;
+var LOCALE_ESES = 6;
+var LOCALE_RURU = 7;
+var LOCALE_PTBR = 8;
+
+var Locale = {
+
+ current: {},
+
+ // All
+ locales: {
+ 0: { // English
+ id: LOCALE_ENUS,
+ name: 'enus',
+ // domain: 'www.wowhead.com',
+ description: 'English'
+ },
+ 2: { // French
+ id: LOCALE_FRFR,
+ name: 'frfr',
+ // domain: 'fr.wowhead.com',
+ description: 'Fran' + String.fromCharCode(231) + 'ais'
+ },
+ 3: { // German
+ id: LOCALE_DEDE,
+ name: 'dede',
+ // domain: 'de.wowhead.com',
+ description: 'Deutsch'
+ },
+ 6: { // Spanish
+ id: LOCALE_ESES,
+ name: 'eses',
+ // domain: 'es.wowhead.com',
+ description: 'Espa' + String.fromCharCode(241) + 'ol'
+ },
+ 8: { // Russian
+ id: LOCALE_RURU,
+ name: 'ruru',
+ // domain: 'ru.wowhead.com',
+ description: String.fromCharCode(1056, 1091, 1089, 1089, 1082, 1080, 1081)
+ }
+ },
+
+ getAll: function() {
+ var result = [];
+
+ for(var id in Locale.locales) {
+ result.push(Locale.locales[id]);
+ }
+
+ return result;
+ },
+
+ getAllByName: function() {
+ var result = Locale.getAll();
+
+ result.sort(function(a, b) {
+ return $WH.strcmp(a.description, b.description);
+ });
+
+ return result;
+ },
+
+ getId: function() {
+ return Locale.current.id;
+ },
+
+ getName: function() {
+ var localeId = Locale.getId();
+
+ return Locale.locales[localeId].name;
+ },
+
+ get: function() {
+ var localeId = Locale.getId();
+
+ return Locale.locales[localeId];
+ },
+
+ set: function(localeId) {
+ $.extend(Locale.current, Locale.locales[localeId]);
+ }
+
+};
+
+// Locale.set(LOCALE_ENUS); // Default
+Locale.set(g_locale.id); // Default
+
var ModelViewer = new function() {
this.validSlots = [1,3,4,5,6,7,8,9,10,13,14,15,16,17,19,20,21,22,23,25,26];
this.slotMap = {1: 1, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 13: 21, 14: 22, 15: 22, 16: 16, 17: 21, 19: 19, 20: 5, 21: 21, 22: 22, 23: 22, 25: 21, 26: 21};
@@ -15758,43 +16455,41 @@ var ModelViewer = new function() {
_z.innerHTML = G;
_z.style.display = '';
}
+ else if (mode == 1) {
+ var G = '';
+ _o.innerHTML = G;
+ _o.style.display = '';
+ }
else {
- if (mode == 1) {
- var G = '';
- _o.innerHTML = G;
- _o.style.display = '';
+ var flashVars = {
+ model: model,
+ modelType: modelType,
+ contentPath: 'http://static.wowhead.com/modelviewer/'
+ // contentPath: g_staticUrl + '/modelviewer/'
+ };
+
+ var params = {
+ quality: 'high',
+ allowscriptaccess: 'always',
+ allowfullscreen: true,
+ menu: false,
+ bgcolor: '#181818',
+ wmode: 'direct'
+ };
+
+ var attributes = { };
+
+ if (modelType == 16 && equipList.length) {
+ flashVars.equipList = equipList.join(',');
}
- else {
- var flashVars = {
- model: model,
- modelType: modelType,
- contentPath: 'http://static.wowhead.com/modelviewer/'
- // contentPath: g_staticUrl + '/modelviewer/'
- };
- var params = {
- quality: 'high',
- allowscriptaccess: 'always',
- allowfullscreen: true,
- menu: false,
- bgcolor: '#181818',
- wmode: 'direct'
- };
-
- var attributes = { };
-
- if (modelType == 16 && equipList.length) {
- flashVars.equipList = equipList.join(',');
- }
-
- // swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes);
- swfobject.embedSWF('http://static.wowhead.com/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', '10.0.0', 'http://static.wowhead.com/modelviewer/expressInstall.swf', flashVars, params, attributes);
- _w.style.display = '';
- }
+ // swfobject.embedSWF(http://static.wowhead.com/modelviewer/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", http://static.wowhead.com/modelviewer/modelviewer/expressInstall.swf', flashVars, params, attributes);
+ swfobject.embedSWF(g_staticUrl + '/modelviewer/ZAMviewerfp11.swf', 'modelviewer-generic', '600', '400', "11.0.0", g_staticUrl + '/modelviewer/expressInstall.swf', flashVars, params, attributes);
+ _w.style.display = '';
}
var
foo = getRaceSex(),
@@ -15874,6 +16569,8 @@ var ModelViewer = new function() {
model = races[raceIndex].model + sexes[sexIndex].model;
modelType = 16;
}
+
+ g_setWowheadCookie('temp_default_3dmodel', race + ',' + sex);
}
clear();
@@ -15947,8 +16644,26 @@ var ModelViewer = new function() {
else {
if (race == -1 && sex == -1) {
var
- cooRace = (g_user && g_user.settings ? g_user.settings.modelrace: 1),
- cooSex = (g_user && g_user.settings ? g_user.settings.modelgender - 1 : 0);
+ cooRace = 1,
+ cooSex = 0;
+
+ if (g_user && g_user.cookies['default_3dmodel']) {
+ var sp = g_user.cookies['default_3dmodel'].split(',');
+ if (sp.length == 2) {
+ cooRace = sp[0];
+ cooSex = sp[1] - 1;
+ }
+ }
+ else {
+ var cookie = g_getWowheadCookie('temp_default_3dmodel');
+ if (cookie) {
+ var sp = cookie.split(',');
+ if (sp.length == 2) {
+ cooRace = sp[0];
+ cooSex = sp[1];
+ }
+ }
+ }
if (isRaceSexValid(cooRace, cooSex)) {
race = cooRace;
@@ -16785,552 +17500,38 @@ var ScreenshotViewer = new function() {
DomContentLoaded.addEvent(this.checkPound)
};
-var Dialog = function() {
-var
- _self = this,
- _template,
- _onSubmit = null,
- _templateName,
+// TODO: Create a "Cookies" object
- _funcs = {},
- _data,
+function g_cookiesEnabled() {
+ document.cookie = 'enabledTest';
+ return (document.cookie.indexOf("enabledTest") != -1) ? true : false;
+}
- _inited = false,
- _form = $WH.ce('form'),
- _elements = {};
+function g_getWowheadCookie(name) {
+ if (g_user.id > 0) {
+ return g_user.cookies[name]; // no point checking if it exists, as undefined tests as false anyways
+ }
+ else {
+ return $WH.gc(name); // plus gc does the same thing..
+ }
+}
- _form.onsubmit = function() {
- _processForm();
- return false
- };
-
- this.show = function(template, opt) {
- if (template) {
- _templateName = template;
- _template = Dialog.templates[_templateName];
- _self.template = _template;
- }
- else {
- return;
- }
-
- if (_template.onInit && !_inited) {
- (_template.onInit.bind(_self, _form, opt))();
- }
-
- if (opt.onBeforeShow) {
- _funcs.onBeforeShow = opt.onBeforeShow.bind(_self, _form);
- }
-
- if (_template.onBeforeShow) {
- _template.onBeforeShow = _template.onBeforeShow.bind(_self, _form);
- }
-
- if (opt.onShow) {
- _funcs.onShow = opt.onShow.bind(_self, _form);
- }
-
- if (_template.onShow) {
- _template.onShow = _template.onShow.bind(_self, _form);
- }
-
- if (opt.onHide) {
- _funcs.onHide = opt.onHide.bind(_self, _form);
- }
-
- if (_template.onHide) {
- _template.onHide = _template.onHide.bind(_self, _form);
- }
-
- if (opt.onSubmit) {
- _funcs.onSubmit = opt.onSubmit;
- }
-
- if (_template.onSubmit)
- _onSubmit = _template.onSubmit.bind(_self, _form);
-
- if (opt.data) {
- _inited = false;
- _data = {};
- $WH.cO(_data, opt.data);
- }
- _self.data = _data;
-
- Lightbox.show('dialog-' + _templateName, {
- onShow: _onShow,
- onHide: _onHide
+function g_setWowheadCookie(name, data, browser) {
+ var temp = name.substr(0, 5) == 'temp_';
+ if (!browser && g_user.id > 0 && !temp) {
+ new Ajax('?cookie=' + name + '&' + name + '=' + $WH.urlencode(data), {
+ method: 'get',
+ onSuccess: function(xhr) {
+ if (xhr.responseText == 0) {
+ g_user.cookies[name] = data;
+ }
+ }
});
- };
-
- this.getValue = function(id) {
- return _getValue(id);
- };
-
- this.setValue = function(id, value) {
- _setValue(id, value);
- };
-
- this.getSelectedValue = function(id) {
- return _getSelectedValue(id);
- };
-
- this.getCheckedValue = function(id) {
- return _getCheckedValue(id);
- };
-
- function _onShow(dest, first) {
- if (first || !_inited) {
- _initForm(dest);
- }
-
- if (_template.onBeforeShow) {
- _template.onBeforeShow();
- }
-
- if (_funcs.onBeforeShow) {
- _funcs.onBeforeShow();
- }
-
- Lightbox.setSize(_template.width, _template.height);
- dest.className = 'dialog';
-
- _updateForm();
-
- if (_template.onShow) {
- _template.onShow();
- }
-
- if (_funcs.onShow) {
- _funcs.onShow();
- }
}
-
- function _initForm(dest) {
- $WH.ee(dest);
- $WH.ee(_form);
-
- var container = $WH.ce('div');
- container.className = 'text';
- $WH.ae(dest, container);
- $WH.ae(container, _form);
- if (_template.title) {
- var h = $WH.ce('h1');
- $WH.ae(h, $WH.ct(_template.title));
- $WH.ae(_form, h);
- }
-
- var
- t = $WH.ce('table'),
- tb = $WH.ce('tbody'),
- mergeCell = false;
-
- $WH.ae(t, tb);
- $WH.ae(_form, t);
-
- for (var i = 0, len = _template.fields.length; i < len; ++i) {
- var
- field = _template.fields[i],
- element;
-
- if (!mergeCell) {
- tr = $WH.ce('tr');
- th = $WH.ce('th');
- td = $WH.ce('td');
- }
-
- field.__tr = tr;
-
- if (_data[field.id] == null) {
- _data[field.id] = (field.value ? field.value: '');
- }
-
- var options;
- if (field.options) {
- options = [];
-
- if (field.optorder) {
- $WH.cO(options, field.optorder);
- }
- else {
- for (var j in field.options) {
- options.push(j);
- }
- }
-
- if (field.sort) {
- options.sort(function(a, b) {
- return field.sort * $WH.strcmp(field.options[a], field.options[b]);
- });
- }
- }
-
- switch (field.type) {
- case 'caption':
- th.colSpan = 2;
- th.style.textAlign = 'left';
- th.style.padding = 0;
-
- if (field.compute) {
- (field.compute.bind(_self, null, _data[field.id], _form, th, tr))();
- }
- else if (field.label) {
- $WH.ae(th, $WH.ct(field.label));
- }
-
- $WH.ae(tr, th);
- $WH.ae(tb, tr);
-
- continue;
- break;
- case 'textarea':
- var f = element = $WH.ce('textarea');
-
- f.name = field.id;
-
- if (field.disabled) {
- f.disabled = true;
- }
-
- f.rows = field.size[0];
- f.cols = field.size[1];
- td.colSpan = 2;
-
- if (field.label) {
- th.colSpan = 2;
- th.style.textAlign = 'left';
- th.style.padding = 0;
- td.style.padding = 0;
-
- $WH.ae(th, $WH.ct(field.label));
- $WH.ae(tr, th);
- $WH.ae(tb, tr);
-
- tr = $WH.ce('tr');
- }
- $WH.ae(td, f);
-
- break;
- case 'select':
-
- var f = element = $WH.ce('select');
-
- f.name = field.id;
-
- if (field.size) {
- f.size = field.size;
- }
-
- if (field.disabled) {
- f.disabled = true;
- }
-
- if (field.multiple) {
- f.multiple = true;
- }
-
- for (var j = 0, len2 = options.length; j < len2; ++j) {
- var o = $WH.ce('option');
-
- o.value = options[j];
-
- $WH.ae(o, $WH.ct(field.options[options[j]]));
- $WH.ae(f, o)
- }
-
- $WH.ae(td, f);
-
- break;
- case 'dynamic':
- td.colSpan = 2;
- td.style.textAlign = 'left';
- td.style.padding = 0;
-
- if (field.compute)
- (field.compute.bind(_self, null, _data[field.id], _form, td, tr))();
-
- $WH.ae(tr, td);
- $WH.ae(tb, tr);
-
- element = td;
-
- break;
- case 'checkbox':
- case 'radio':
- var k = 0;
- element = [];
- for (var j = 0, len2 = options.length; j < len2; ++j) {
- var
- s = $WH.ce('span'),
- f,
- l,
- uniqueId = 'sdfler46' + field.id + '-' + options[j];
-
- if (j > 0 && !field.noInputBr) {
- $WH.ae(td, $WH.ce('br'));
- }
- if ($WH.Browser.ie6 && field.type == 'radio') {
- l = $WH.ce("");
- f = $WH.ce("");
- }
- else {
- l = $WH.ce('label');
- l.setAttribute('for', uniqueId);
- l.onmousedown = $WH.rf;
-
- f = $WH.ce('input');
- f.setAttribute('type', field.type);
- f.name = field.id;
- }
- f.value = options[j];
- f.id = uniqueId;
-
- if (field.disabled) {
- f.disabled = true;
- }
- if (field.submitOnDblClick) {
- l.ondblclick = f.ondblclick = function(e) {
- _processForm();
- };
- }
-
- if (field.compute) {
- (field.compute.bind(_self, f, _data[field.id], _form, td, tr))();
- }
-
- $WH.ae(l, f);
- $WH.ae(l, $WH.ct(field.options[options[j]]));
- $WH.ae(td, l);
- element.push(f);
- }
- break;
- default: // Textbox
- var f = element = $WH.ce('input');
- f.name = field.id;
-
- if (field.size) {
- f.size = field.size;
- }
-
- if (field.disabled) {
- f.disabled = true ;
- }
-
- if (field.submitOnEnter) {
- f.onkeypress = function(e) {
- e = $WH.$E(e);
- if (e.keyCode == 13) {
- _processForm();
- }
- }
- }
- f.setAttribute('type', field.type);
- $WH.ae(td, f);
- break;
- }
-
- if (field.label) {
- if (field.type == 'textarea') {
- if (field.labelAlign) {
- td.style.textAlign = field.labelAlign;
- }
- td.colSpan = 2;
- }
- else {
- if (field.labelAlign) {
- th.style.textAlign = field.labelAlign;
- }
- $WH.ae(th, $WH.ct(field.label));
- $WH.ae(tr, th);
- }
- }
-
- if (field.type != 'checkbox' && field.type != 'radio') {
- if (field.width) {
- f.style.width = field.width;
- }
-
- if (field.compute && field.type != 'caption' && field.type != 'dynamic') {
- (field.compute.bind(_self, f, _data[field.id], _form, td, tr))();
- }
- }
-
- if (field.caption) {
- var s = $WH.ce('small');
- if (field.type != 'textarea')
- s.style.paddingLeft = '2px';
- s.className = 'q0'; // commented in 5.0?
- $WH.ae(s, $WH.ct(field.caption));
- $WH.ae(td, s);
- }
-
- $WH.ae(tr, td);
- $WH.ae(tb, tr);
-
- mergeCell = field.mergeCell;
- _elements[field.id] = element;
- }
-
- for (var i = _template.buttons.length; i > 0; --i) {
- var
- button = _template.buttons[i - 1],
- a = $WH.ce('a');
-
- a.href = 'javascript:;';
- a.onclick = _processForm.bind(a, button[0]);
- a.className = 'dialog-' + button[0];
- $WH.ae(a, $WH.ct(button[1]));
- $WH.ae(dest, a);
- }
-
- var _ = $WH.ce('div');
- _.className = 'clear';
- $WH.ae(dest, _);
-
- _inited = true;
+ else if (browser || g_user.id == 0) {
+ $WH.sc(name, 14, data, null, location.hostname);
}
-
- function _updateForm() {
- for (var i = 0, len = _template.fields.length; i < len; ++i) {
- var
- field = _template.fields[i],
- f = _elements[field.id];
-
- switch (field.type) {
- case 'caption': // Do nothing
- break;
- case 'select':
- for (var j = 0, len2 = f.options.length; j < len2; j++) {
- f.options[j].selected = (f.options[j].value == _data[field.id] || $WH.in_array(_data[field.id], f.options[j].value) != -1);
- }
- break;
- case 'checkbox':
- case 'radio':
- for (var j = 0, len2 = f.length; j < len2; j++) {
- f[j].checked = (f[j].value == _data[field.id] || $WH.in_array(_data[field.id], f[j].value) != -1);
- }
- break;
-
- default:
- f.value = _data[field.id];
- break;
- }
-
- if (field.update) {
- (field.update.bind(_self, null, _data[field.id], _form, f))();
- }
- }
- }
-
- function _onHide() {
- if (_template.onHide) {
- _template.onHide();
- }
- if (_funcs.onHide) {
- _funcs.onHide();
- }
- }
-
- function _processForm(button) {
- // if (button == 'x') { // Special case
- if (button == 'cancel') { // Special case
- return Lightbox.hide();
- }
-
- for (var i = 0, len = _template.fields.length; i < len; ++i) {
- var
- field = _template.fields[i],
- newValue;
-
- switch (field.type) {
- case 'caption': // Do nothing
- continue;
- case 'select':
- newValue = _getSelectedValue(field.id);
- break;
- case 'checkbox':
- case 'radio':
- newValue = _getCheckedValue(field.id);
- break;
- case 'dynamic':
- if (field.getValue) {
- newValue = field.getValue(field, _data, _form);
- break;
- }
- default:
- newValue = _getValue(field.id);
- break;
- }
- if (field.validate) {
- if (!field.validate(newValue, _data, _form)) {
- return;
- }
- }
-
- if (newValue && typeof newValue == 'string') {
- newValue = $WH.trim(newValue);
- }
- _data[field.id] = newValue;
- }
-
- _submitData(button);
- }
-
- function _submitData(button) {
- var ret;
-
- if (_onSubmit) {
- ret = _onSubmit(_data, button, _form);
- }
-
- if (_funcs.onSubmit) {
- ret = _funcs.onSubmit(_data, button, _form);
- }
-
- if (ret === undefined || ret)
- Lightbox.hide();
-
- return false;
- }
-
- function _getValue(id) {
- return _elements[id].value;
- }
-
- function _setValue(id, value) {
- _elements[id].value = value;
- }
-
- function _getSelectedValue(id) {
- var
- result = [],
- f = _elements[id];
-
- for (var i = 0, len = f.options.length; i < len; i++) {
- if (f.options[i].selected) {
- result.push(parseInt(f.options[i].value) == f.options[i].value ? parseInt(f.options[i].value) : f.options[i].value);
- }
- }
- if (result.length == 1) {
- result = result[0];
- }
- return result;
- }
-
- function _getCheckedValue(id) {
- var
- result = [],
- f = _elements[id];
-
- for (var i = 0, len = f.length; i < len; i++) {
- if (f[i].checked) {
- result.push(parseInt(f[i].value) == f[i].value ? parseInt(f[i].value) : f[i].value);
- }
- }
-
- return result;
- }
-};
-Dialog.templates = {};
+}
var ContactTool = new function() {
this.general = 0;
@@ -18107,7 +18308,7 @@ var Announcement = function(opt) {
return;
}
- if (g_user.id == 0 && $WH.gc('announcement-' + this.id) == 'closed') {
+ if (g_user.id == 0 && (!g_cookiesEnabled() || g_getWowheadCookie('announcement-' + this.id) == 'closed')) {
return;
}
@@ -18230,8 +18431,8 @@ Announcement.prototype = {
},
markRead: function() {
- // g_setWowheadCookie('announcement-' + this.id, 'closed');
- $WH.sc('announcement-' + this.id, 20, 'closed', "/", location.hostname);
+ g_setWowheadCookie('announcement-' + this.id, 'closed');
+ // $WH.sc('announcement-' + this.id, 20, 'closed', "/", location.hostname);
this.hide();
},
@@ -18242,8 +18443,7 @@ Announcement.prototype = {
setText: function(text) {
this.text = text;
- // Markup.printHtml(this.text, this.parent + '-markup');
- $WH.ge(this.parent + '-markup').innerHTML = this.text;
+ Markup.printHtml(this.text, this.parent + '-markup');
}
};