A chrome extension that runs your gist script on page equipped with all powerful Chrome background API
- Scrap the page
- Watch any changes on website
- Chrome Notification
- Load custom popup page
- AMD like Require
- Implement Template
- Grab any elements on the page
- Add, remove and edit response headers
- Set cookie
- Inject styles and scripts
- Update popup panel after reload
- Loading gist scripts before portal
- Fix the "current loaded files"
- Fix issue of loading removed script on gist
- Impletment
@require
to pre-load lib like jQuery - Fix RegExt for path
- Use match pattern for url instead
To modify headers on Content Security Policy.
// this allows to call external scripts on site with CSP, like facebook
hexo.modifyHeader('content-security-policy', function (headers, details) {
header.value = headers.value.split(';').map(function (header) {
if (header.includes('script-src')) {
header += ' https://*.cloudfront.net';
}
return header;
}).join(';');
return header;
})
To render templates in mustache.
- All templates need to be in one gist html file.
- It uses HTML imports.
- To make the templates are loaded before the script run, use
hexo.ready
.
// In gist html file: hexo-demo.html
<script type="x-tmpl-mustache" id="template-id">
<div class='hexo-message'>
{{#msg}}
<span >Hexo message {{ msg }}</span>
{{/msg}}
{{^msg}}
<span >No message</span>
{{/msg}}
</div>
</script>
// In gist javascript file: hexo-demo.js
hexo.ready(() => {
let complied = hexo.template('#template-id');
let html = complied({ msg: 'hello world!' });
$('body').append(html);
});