mirror of
https://github.com/moparisthebest/mail
synced 2024-08-13 16:43:47 -04:00
20 lines
561 B
JavaScript
20 lines
561 B
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
// set listener for event from main window
|
|
window.addEventListener('message', function(e) {
|
|
var html = e.data.html;
|
|
|
|
// make links open in a new window
|
|
html = html.replace(/<a /g, '<a target="_blank" ');
|
|
|
|
// remove sources where necessary
|
|
if (e.data.removeImages) {
|
|
html = html.replace(/(<img[^>]+\b)src=['"][^'">]+['"]/ig, function(match, prefix) {
|
|
return prefix;
|
|
});
|
|
}
|
|
|
|
document.body.innerHTML = html;
|
|
}, false);
|
|
})(); |