843
edits
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
/* Class Code */ | /* Class Code */ | ||
(function () { | (function () { | ||
function colorContent(text, color) { | |||
var obj = {}; | |||
obj.text = text; | |||
obj.color = color; | |||
obj.xpath = "//td[contains(text(),'" + text + "')]"; | |||
return obj; | |||
} | |||
/* Active Code */ | /* Active Code */ | ||
console.log("on page: " + mw.config.get('wgPageName')); | console.log("on page: " + mw.config.get('wgPageName')); | ||
if (mw.config.get('wgPageName') === 'Mobile_Suits') { | if (mw.config.get('wgPageName') === 'Mobile_Suits') { | ||
var colorList = [ | var colorList = [ | ||
colorContent('Super High Tensile Steel', '#7b9095') | colorContent('Super High Tensile Steel', '#7b9095'), | ||
colorContent('x Titanium Alloy','#067da1'), | |||
colorContent('x Luna Titanium Alloy','#0799c5') | |||
] | ] | ||
colorList. | for(var i = 0; i < colorList.length; i++) | ||
{ | |||
var colorElement = colorList[i]; | |||
var y = document.evaluate( | var y = document.evaluate( | ||
colorElement.xpath, | colorElement.xpath, | ||
| Line 24: | Line 34: | ||
x.style.color = colorElement.color | x.style.color = colorElement.color | ||
} | } | ||
} | } | ||
} | } | ||
}()); | }()); | ||
edits