dataverse-lrs/previewers/js/text.js

80 lines
1.7 KiB
JavaScript

$(document).ready(function() {
startPreview(true);
});
function translateBaseHtmlPage() {
var textPreviewText = $.i18n( "textPreviewText" );
$( '.textPreviewText' ).text( textPreviewText );
}
function writeContentAndData(data, fileUrl, file, title, authors) {
addStandardPreviewHeader(file,title, authors);
//removing href and target attributes from the default
var whiteList = {
a: ["title"],
abbr: ["title"],
address: [],
area: [],
article: [],
aside: [],
audio: [],
b: [],
bdi: ["dir"],
bdo: ["dir"],
big: [],
blockquote: ["cite"],
br: [],
caption: [],
center: [],
cite: [],
code: [],
col: ["align", "valign", "span", "width"],
colgroup: ["align", "valign", "span", "width"],
dd: [],
del: ["datetime"],
details: ["open"],
div: [],
dl: [],
dt: [],
em: [],
font: ["color", "size", "face"],
footer: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
header: [],
hr: [],
i: [],
img: ["src", "alt", "title", "width", "height"],
ins: ["datetime"],
li: [],
mark: [],
nav: [],
ol: [],
p: [],
pre: [],
s: [],
section: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
table: ["width", "border", "align", "valign"],
tbody: ["align", "valign"],
td: ["width", "rowspan", "colspan", "align", "valign"],
tfoot: ["align", "valign"],
th: ["width", "rowspan", "colspan", "align", "valign"],
thead: ["align", "valign"],
tr: ["rowspan", "align", "valign"],
tt: [],
u: [],
ul: [],
video: []
};
options = {"whiteList":whiteList}; // Custom rules
$('.preview').append($("<pre/>").html(filterXSS(data,options)));
}