': 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 += '| ' + (icon ? Markup.toHtml('[icon name=' + icon + ' size=small url=' + href + ']', { skipReset: true }) : '') + ' | ' + html + ' |
';
- }
-
- if(str)
- 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);
- }
- 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 + '' : '');
- }
- },
- 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(',');
- // sarjuuk: nyi :( 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 = '
';
- return [ str ];
- }
- else if(attr.object)
- {
- str = '
';
- return [ str ];
- }
- else if(attr.item && attr.slot)
- {
- str = '
';
- return [ str ];
- }
- else if(attr.itemset)
- {
- str = '';
- }
- 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+/ },
- arena: { req: false, valid: /^[0-9]+$/ },
- honor: { 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.honor)
- currency.push([104, attr.honor]);
- if(attr.arena)
- currency.push([103, attr.arena]);
-
- 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;
- }
- },
- 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' : '') + '">
' + 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$/ },
- },
- 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(g_spells[id] && g_spells[id][nameCol])
- {
- var spell = g_spells[id];
- return '
' + Markup._safeHtml(spell[nameCol]) + '';
- }
-
- 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 += '
';
-
- var tabs = attr._contents;
-
- for(var i = 0; i < tabs.length; ++i)
- {
- var tab = tabs[i];
-
- 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, '' + (attr.unnamed ? 'th' : 'td') + '>'];
- },
- 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]*?>', '' + t[j] + '>', '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._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 = '';
- return [pre, ''];
- }
- else
- {
- return ['', ''];
- }
- }
- else // [url]blah[/url]
- {
- target = attr._textContents;
- target = target.replace(/&/, '&');
- if(Markup._isUrlSafe(target))
- {
- var pre = '';
- return [pre + target + ''];
- }
- 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 = ''];
- }
- },
- 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 += '';
-
- return html;
- },
- fromHtml: function(str)
- {
- var m;
- if(m = str.match(/';
+ var screenshot = {
+ url: url,
+ caption: img.alt,
+ width: img.width,
+ height: img.height,
+ noMarkup: true
+ };
+ g_screenshots[Markup.uid].push(screenshot);
+ }
+ 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 + '' : '');
+ }
+ },
+ 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 = '
';
+ return [ str ];
+ }
+ else if(attr.object)
+ {
+ str = '
';
+ return [ str ];
+ }
+ else if(attr.item && attr.slot)
+ {
+ str = '
';
+ return [ str ];
+ }
+ else if(attr.itemset)
+ {
+ str = '';
+ }
+ 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+/ },
+ arena: { req: false, valid: /^[0-9]+$/ },
+ honor: { 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.honor)
+ currency.push([104, attr.honor]);
+ if(attr.arena)
+ currency.push([103, attr.arena]);
+
+ 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;
+ }
+ },
+ 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' : '') + '">
' + 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$/ },
+ },
+ 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(g_spells[id] && g_spells[id][nameCol])
+ {
+ var spell = g_spells[id];
+ return '
' + Markup._safeHtml(spell[nameCol]) + '';
+ }
+
+ 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 += '
';
+
+ var tabs = attr._contents;
+
+ for(var i = 0; i < tabs.length; ++i)
+ {
+ var tab = tabs[i];
+
+ 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, '' + (attr.unnamed ? 'th' : 'td') + '>'];
+ },
+ 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]*?>', '' + t[j] + '>', '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._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 = '';
+ return [pre, ''];
+ }
+ else
+ {
+ return ['', ''];
+ }
+ }
+ else // [url]blah[/url]
+ {
+ target = attr._textContents;
+ target = target.replace(/&/, '&');
+ if(Markup._isUrlSafe(target))
+ {
+ var pre = '';
+ return [pre + target + ''];
+ }
+ 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 = ''];
+ }
+ },
+ 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 += '';
+
+ return html;
+ },
+ fromHtml: function(str)
+ {
+ var m;
+ if(m = str.match(/