Guides: initial implementation

* a guide is a wrapper around an article providing management tools.
 * administration is limited to the review process. Needs to be expanded.
 * articles on DB pages are seperate. Editor will be added in the future.
This commit is contained in:
Sarjuuk
2022-03-02 18:19:50 +01:00
parent 33a870ef78
commit b890d6504e
63 changed files with 6734 additions and 338 deletions

View File

@@ -194,6 +194,12 @@ $WH.str_replace = function(z, a, b) {
return z;
}
$WH.htmlentities = function(a) {
return a.replace(/[\u00A0-\u9999<>\&]/gim, function(b) {
return "&#" + b.charCodeAt(0) + ";"
})
};
// Encode URL for internal use (e.g. Ajax)
$WH.urlencode = function(z) {
z = encodeURIComponent(z);
@@ -373,6 +379,14 @@ $WH.gE = function(z, y) {
return z.getElementsByTagName(y);
}
$WH.qs = function (y, z) {
return (z || document).querySelector(y);
};
$WH.qsa = function (y, z) {
return (z || document).querySelectorAll(y);
};
// Create element
$WH.ce = function(z, p, c) {
var a = document.createElement(z);
@@ -935,24 +949,26 @@ $WH.g_getIdFromTypeName = function (typeName) {
return (lookup[typeName] ? lookup[typeName] : -1)
};
$WH.g_getIdFromTypeName.L = {
npc: 1,
object: 2,
item: 3,
itemset: 4,
quest: 5,
spell: 6,
zone: 7,
faction: 8,
pet: 9,
achievement: 10,
title: 11,
event: 12,
"class": 13,
race: 14,
skill: 15,
currency: 17,
profile: 100
npc: 1,
object: 2,
item: 3,
itemset: 4,
quest: 5,
spell: 6,
zone: 7,
faction: 8,
pet: 9,
achievement: 10,
title: 11,
event: 12,
"class": 13,
race: 14,
skill: 15,
currency: 17,
profile: 100,
guide: 300
};
@@ -2315,6 +2331,23 @@ $WH.g_createButton = function(text, href, opts)
return btn;
}
$WH.g_isVisible = function (el) {
return !(el.offsetWidth === 0 && el.offsetHeight === 0);
}
$WH.g_getHeaderHeight = function () {
let el = ['header', 'toptabs', 'topbar', 'main-precontents']
let h = 0;
for (i in el) {
let e = $WH.ge(el[i]);
if (e)
h += e.getBoundingClientRect().height;
}
return h;
};
/* Aowow: end replacement */
if ($WH.isset('$WowheadPower')) {