mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 21:19:19 +00:00
cleanup
This commit is contained in:
parent
3ae17171e2
commit
332ee0e6b5
@ -427,12 +427,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- polyfill -->
|
<!-- polyfill -->
|
||||||
<script src="./static/javascripts/fetch.umd.js"></script>
|
<script src="./static/javascripts/fetch.umd.js"></script>
|
||||||
<script src="./static/javascripts/url-polyfill.min.js"></script>
|
|
||||||
<!-- external -->
|
<!-- external -->
|
||||||
<script src="./static/javascripts/vue.min.js"></script>
|
<script src="./static/javascripts/vue.min.js"></script>
|
||||||
<script src="./static/javascripts/vue-lazyload.js"></script>
|
<script src="./static/javascripts/vue-lazyload.js"></script>
|
||||||
<script src="./static/javascripts/Readability.min.js"></script>
|
|
||||||
<script src="./static/javascripts/purify.min.js"></script>
|
|
||||||
<!-- internal -->
|
<!-- internal -->
|
||||||
<script src="./static/javascripts/api.js"></script>
|
<script src="./static/javascripts/api.js"></script>
|
||||||
<script src="./static/javascripts/app.js"></script>
|
<script src="./static/javascripts/app.js"></script>
|
||||||
|
@ -26,28 +26,6 @@ var debounce = function(callback, wait) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sanitize = function(content, base) {
|
|
||||||
// WILD: `item.link` may be a relative link (or some nonsense)
|
|
||||||
try { new URL(base) } catch(err) { base = null }
|
|
||||||
|
|
||||||
var sanitizer = new DOMPurify
|
|
||||||
sanitizer.addHook('afterSanitizeAttributes', function(node) {
|
|
||||||
// set all elements owning target to target=_blank
|
|
||||||
if ('target' in node)
|
|
||||||
node.setAttribute('target', '_blank')
|
|
||||||
// set non-HTML/MathML links to xlink:show=new
|
|
||||||
if (!node.hasAttribute('target') && (node.hasAttribute('xlink:href') || node.hasAttribute('href')))
|
|
||||||
node.setAttribute('xlink:show', 'new')
|
|
||||||
|
|
||||||
// set absolute urls
|
|
||||||
if (base && node.attributes.href && node.attributes.href.value)
|
|
||||||
node.href = new URL(node.attributes.href.value, base).toString()
|
|
||||||
if (base && node.attributes.src && node.attributes.src.value)
|
|
||||||
node.src = new URL(node.attributes.src.value, base).toString()
|
|
||||||
})
|
|
||||||
return sanitizer.sanitize(content, {FORBID_TAGS: ['style'], FORBID_ATTR: ['style', 'class']})
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.use(VueLazyload)
|
Vue.use(VueLazyload)
|
||||||
|
|
||||||
Vue.directive('scroll', {
|
Vue.directive('scroll', {
|
||||||
|
3
src/assets/javascripts/purify.min.js
vendored
3
src/assets/javascripts/purify.min.js
vendored
File diff suppressed because one or more lines are too long
1
src/assets/javascripts/url-polyfill.min.js
vendored
1
src/assets/javascripts/url-polyfill.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user