Files
aowow/setup/tools/filegen/templates/global.js/summary.js
Sarjuuk 6557e70d5c Template/Update (Part 47)
* split global.js into its components, so it can be reasonably processed by setup
 * make reputation requirements configurable
 * move Markup and Locale back into global.js (removed associated build scripts)
 * extend Icon to display iconId in lightbox popup
2025-09-25 16:01:14 +02:00

79 lines
1.8 KiB
JavaScript

/*
Global functions related to the Summary class (item comparison, item set summary)
*/
var suDialog;
function su_addToSaved(items, nItems, newWindow, level)
{
if (!items)
return;
if (!suDialog)
suDialog = new Dialog();
var doCompare = function(data)
{
var saved = g_getWowheadCookie('compare_groups'),
url = '?compare';
if (data.action > 1) // Save
{
if (saved)
items = saved + ';' + items;
g_setWowheadCookie('compare_groups', items, true);
if (level)
g_setWowheadCookie('compare_level', level, true);
}
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: nItems, action: 1 },
onSubmit: doCompare
});
}
Dialog.templates.docompare = {
title: LANG.dialog_compare,
width: 400,
// buttons: [['check', LANG.ok], ['x', LANG.cancel]],
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
}
}
]
};