mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Implemented Marked usage.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
var loot = {};
|
var loot = {};
|
||||||
|
var marked;
|
||||||
function isStorageSupported() {
|
function isStorageSupported() {
|
||||||
try {
|
try {
|
||||||
return ('localStorage' in window && window['localStorage'] !== null && window['localStorage'] !== undefined);
|
return ('localStorage' in window && window['localStorage'] !== null && window['localStorage'] !== undefined);
|
||||||
@@ -756,8 +757,8 @@ function updateInterfaceWithGameInfo(response) {
|
|||||||
for (var i = 0; i < loot.game.globalMessages.length; ++i) {
|
for (var i = 0; i < loot.game.globalMessages.length; ++i) {
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
li.className = loot.game.globalMessages[i].type;
|
li.className = loot.game.globalMessages[i].type;
|
||||||
/* innerHTML is open to abuse, but for hyperlinking it's too useful. */
|
/* Use the Marked library for Markdown formatting support. */
|
||||||
li.innerHTML = loot.game.globalMessages[i].content[0].str;
|
li.innerHTML = marked(loot.game.globalMessages[i].content[0].str);
|
||||||
generalMessagesList.appendChild(li);
|
generalMessagesList.appendChild(li);
|
||||||
|
|
||||||
if (li.className == 'warn') {
|
if (li.className == 'warn') {
|
||||||
@@ -859,8 +860,8 @@ function updateInterfaceWithGameInfo(response) {
|
|||||||
for (var j = 0; j < data.plugins[i].messages.length; ++j) {
|
for (var j = 0; j < data.plugins[i].messages.length; ++j) {
|
||||||
var messageLi = document.createElement('li');
|
var messageLi = document.createElement('li');
|
||||||
messageLi.className = data.plugins[i].messages[j].type;
|
messageLi.className = data.plugins[i].messages[j].type;
|
||||||
// innerHTML is open to abuse, but for hyperlinking it's too useful.
|
// Use the Marked library for Markdown formatting support.
|
||||||
messageLi.innerHTML = data.plugins[i].messages[j].content;
|
messageLi.innerHTML = marked(data.plugins[i].messages[j].content);
|
||||||
clone.getElementsByTagName('ul')[0].appendChild(messageLi);
|
clone.getElementsByTagName('ul')[0].appendChild(messageLi);
|
||||||
|
|
||||||
if (messageLi.className == 'warn') {
|
if (messageLi.className == 'warn') {
|
||||||
@@ -898,8 +899,11 @@ function getGameData() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initGlobalVars();
|
require(['js/marked'], function(response) {
|
||||||
getGameData();
|
marked = response;
|
||||||
if (isStorageSupported()) {
|
initGlobalVars();
|
||||||
loadSettings();
|
getGameData();
|
||||||
}
|
if (isStorageSupported()) {
|
||||||
|
loadSettings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user