stylus/content/install-hook-greasyfork.js
2020-12-17 23:23:17 +03:00

15 lines
452 B
JavaScript

'use strict';
addEventListener('message', async function onMessage(e) {
if (e.origin === location.origin &&
e.data &&
e.data.name &&
e.data.type === 'style-version-query') {
removeEventListener('message', onMessage);
const {API} = self.require('/js/msg');
const style = await API.usercss.find(e.data) || {};
const {version} = style.usercssData || {};
postMessage({type: 'style-version', version}, '*');
}
});